UIImagePickerController inside UIPopoverController doesn't show Cancel button on iOS7

本小妞迷上赌 提交于 2019-12-02 02:59:58

@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{

    }

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

pickerController.navigationBar.tintColor = UIColor.blueColor()

Sushil Sharma

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!