Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7 status bar overlaps camera controls on UIImagePickerController

I've tried setting the Info.plist 'View controller-based status bar appearance' to NO, I've tried calling

[[UIApplication sharedApplication] setStatusBarHidden:YES];

I've tried

-(BOOL)prefersStatusBarHidden{ 
  return YES;
}

I've tried launching the picker with

[self presentViewController:picker animated:NO completion:^{
  [[UIApplication sharedApplication] setStatusBarHidden:YES];
}

And still, there is a status bar overlapping the camera controls. It's only there in iOS 7 though.

The status bar doesn't show up any where else in the app. I feel like I'm missing an important piece of the puzzle here, and no amount of reading about the View Controller or UIImagePickerController has helped me find said puzzle piece.

I'm hoping some one else has a little insight into this problem. Thank you.

EDIT: My desired effect is that the Status Bar shows up every in the app, except on the camera picker and a few other "outside" (Email related) view controllers we use.

like image 595
alphanumeric character Avatar asked Sep 17 '13 17:09

alphanumeric character


2 Answers

If you want to keep ViewController-Based Status Bar Appearance, subclass UIImagePickerController and override prefersStatusBarHidden and childViewControllerForStatusBarHidden.

@interface NoStatusBarImagePickerController : UIImagePickerController
@end

@implementation NoStatusBarImagePickerController

- (BOOL)prefersStatusBarHidden {
  return YES;
}

- (UIViewController *)childViewControllerForStatusBarHidden {
  return nil;
}

@end
like image 55
voxlet Avatar answered Nov 08 '22 11:11

voxlet


Try this :

- (void)navigationController:(UINavigationController *)navigationController     willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}

in your appDelegate.

like image 34
Alexandru Dranca Avatar answered Nov 08 '22 13:11

Alexandru Dranca