30

Can't hide status bar on view controller on ios 7 device.

Already tried setting through plist file and also in Appcontroller.mm but still i doesn't hide the status bar

[[UIApplication sharedApplication] setStatusBarHidden:YES];//Doesn't help
2

5 Answers 5

84

Go to info.plist and add two attributes if not present. set "Status bar is initially hidden" to YES and set UIViewControllerBasedStatusBarAppearance to NO. This will hide status bar for your app.

2
  • 9
    Just in case you can't find UIViewControllerBasedStatusBarAppearance, it appears as "View controller-based status bar appearance".
    – enreas
    Apr 10, 2014 at 13:23
  • 1
    Status bar is initially hidden is a checkbox labeled "Hide during application launch" on the general tab in the project settings in the deployment info section. Aug 16, 2014 at 17:39
4

That's because iOS 7 has changed the way it deals with the status bar.

Setting UIViewControllerBasedStatusBarAppearance to NO on your app Info.plist should work.

4

I had the same issue recently. Be sure that you are targeting the correct view controller. Try to hide the status bar in the root view controller. Also, I´m implementing the method (BOOL)prefersStatusBarHidden (doc) in my UIViewControllers to hide the status bar. By using this method, you can forward the preferred configuration to a "child view controller". Also, this method works fine in UIViewControllers presented as modal.

2
// for ios 7 
- (BOOL)prefersStatusBarHidden
{
    return YES; 
}


// for ios 6
- (void)viewWillAppear:(BOOL)animated 
{
    [super viewWillAppear:animated];
    [[UIApplication sharedApplication] setStatusBarHidden:YES]; 
}
0

For iPad (iOS 7.0) need to put another value at Info.plist file.

UIStatusBarHidden boolean value YES.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.