简体   繁体   中英

iOS 8: status bar doesn't work with UIImagePickerController

I've a view with UIImagePickerController..

In the whole application I have:

/* white color */
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

But in this case I need to view status bar black, so I set it:

/* black color */ 
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];

I've do this in delegate

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;

But seems ignoring instruction.

Works only for iOS < 8. I've already read this question and other, but I can't make it work.

Just change it from your xib / storyboad if you want to change for particular view means.

在此处输入图片说明

Try like this while presenting UIImagePickerViewController:

[self presentViewController:imagePickerController animated:YES completion:^{
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
}];

I resolved my problem in this way:

UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];

if(IS_IOS8_AND_UP) {
    imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;
} else {
    imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
}

imagePickerController.delegate = self;
[self presentViewController:imagePickerController animated:YES completion:nil];

And then in delegate I set the default status bar style.

Hope this help!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM