iOS 7 status bar overlaps camera controls on UIIma

2019-01-22 23:43发布

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.

9条回答
唯我独甜
2楼-- · 2019-01-22 23:45

The PsychoDad method works for me. I put the following

[[UIApplication sharedApplication] setStatusBarHidden:YES];

into the method viewWillDisappear of subclass of UIImagePickerController.

But the Alexandru Dranca method is better because in that way the status bar don't appear at all!

However I think this is a BUG of IOS 7...

查看更多
爷、活的狠高调
3楼-- · 2019-01-22 23:48

I've been on this bug for repairing ToonPAINT for iOS7 and the thing that finally worked other than setting the two things in the Info.plist file (Status bar is initially hidden = NO; View controller-based status bar appearance = NO)

was to change the style of the status bar (even though I didn't want it shown at all); It was not enough to just hide the status bar; sounds like an iOS7 bug.

In the app delegate add:

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

{NB .. UIStatusBarStyleBlackTranslucent is deprecated, probably use UIStatusBarStyleLightContent if trying this}

查看更多
甜甜的少女心
4楼-- · 2019-01-22 23:59

"View controller-based status bar appearance" set to NO, works for me.

查看更多
混吃等死
5楼-- · 2019-01-23 00:00

Try this :

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

in your appDelegate.

查看更多
可以哭但决不认输i
6楼-- · 2019-01-23 00:01

you should leave the

-(BOOL)prefersStatusBarHidden{ 
  return YES;
}

and also add this

-(void)viewWillAppear:(BOOL)animated {
    ...
    [self setNeedsStatusBarAppearanceUpdate];
    ...
}
查看更多
在下西门庆
7楼-- · 2019-01-23 00:04

I think the answer to this question is "This is an iOS 7 bug". None of the methods here helped in our case, and several people have tried to fix this now.

I can't say what steps to reproduce this, but I've seen enough people out there with the same issue, that I think it's safe to say that this is in fact an iOS 7 bug. Most people can fix this problem with the multiple methods listed above. Rarely though, you can't fix it that way. I hope if you are reading this, you are not also one of those people.

查看更多
登录 后发表回答