UIImagePickerController changes statusbar style to black/opaque. I want to keep status-bar style black/translucent. I'm finding a way to prevent status bar style changing. Or making it transited smoothly. Now, presenting UIImagePickerController changes status-bar style instantly, even -[presentModalViewController:picker animated:YES] specified.
Any method, welcome, including hacking or private method. This is an app for AppStore, however I want to even try.
I wanted the status bar to remain black opaque while showing the photo library picker (the photo picker changes it to black translucent) and this solved the issue for me.
Set the UIImagePickerDelegate:
libraryUI.delegate = self;
Implement the following callback:
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated {
if ([navigationController isKindOfClass:[UIImagePickerController class]] &&
((UIImagePickerController *)navigationController).sourceType == UIImagePickerControllerSourceTypePhotoLibrary) {
[[UIApplication sharedApplication] setStatusBarHidden:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:NO];
}
}
You can specify any kind of status bar style in here. In your case, you would probably have to remove the sourceType check and specify UIStatusBarStyleBlackTranslucent
.
Try this working perfectly on ios 8
-(void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
[[[viewController navigationController] navigationBar] setBarStyle:UIBarStyleBlack];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With