UIImagePickerController breaks status bar appearance
ios7
Solution
None of the solutions above worked for me, but by combining Rich86man's and iOS_DEV_09's answers I've got a consistently working solution:
UIImagePickerController* imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
and
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
Regarding this awesome solution. For 2014 / iOS8 I found in some cases you need to ALSO include `prefersStatusBarHidden` and, possibly, `childViewControllerForStatusBarHidden` So...
-(void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
-(BOOL)prefersStatusBarHidden // iOS8 definitely needs this one. checked.
{
return YES;
}
-(UIViewController *)childViewControllerForStatusBarHidden
{
return nil;
}
-(void)showCamera
{
self.cameraController = [[UIImagePickerController alloc] init];
self.cameraController.delegate = (id)self; // dpjanes solution!
etc...
Problem
In my .plist file, I have "View controller-based status bar appearance" set to `NO`. But after `UIImagePickerController`, my app behaves as if the option is set to `YES`. In my app, I present a VC that presents a `UIImagePickerController`. The problem happens like this: - After photo picker is presented, when a photo library is picked, the color of the status bar text changes. - Then once, `UIImagePickerController` is dismissed, status bar spacing changes for the rest of my app and all the navigation bar for other controllers displays under the status bar. Is there a way to solve this without managing status bar in my view controllers?