UIImagePickerController inside UIPopoverController doesn't show Cancel button on iOS7

前端 未结 3 1169
甜味超标
甜味超标 2021-01-25 10:13

I\'m using UIImagePickerController inside a UIPopoverController to select image just from photo albums. When I launch app on device running iOS 8, the Cancel button on the top r

相关标签:
3条回答
  • 2021-01-25 10:30

    @JozoL Write the Below Code this works

    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
            UINavigationItem *pickerNavBarTopItem;
            // add done button to right side of nav bar
            UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel"
                                                                           style:UIBarButtonItemStylePlain
                                                                          target:self
                                                                          action:@selector(doSomething)];
    
            UINavigationBar *bar = navigationController.navigationBar;
            [bar setHidden:NO];
            pickerNavBarTopItem = bar.topItem;
            pickerNavBarTopItem.rightBarButtonItem = doneButton;
        }
        -(void)doSomething{
    
        }
    
    0 讨论(0)
  • 2021-01-25 10:34

    In my case, UIImagePickerController was not showing its cancel button . So I tried adding this line to code:

    pickerController.navigationBar.barStyle = UIBarStyleDefault;
    

    And this worked for me.Try setting color of Cancel button like this

     pickerController.navigationBar.tintColor = [UIColor blackColor];
    

    Try using this code and let me know if it helps you.

    0 讨论(0)
  • 2021-01-25 10:41

    For swift2.x you can try below code, Its work for me

    pickerController.navigationBar.tintColor = UIColor.blueColor()

    0 讨论(0)
提交回复
热议问题