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
Dhaval Bhadania
  • 3,090
  • 1
  • 20
  • 35
Dhaval
  • 301
  • 1
  • 3
  • 5
  • 3
    Here's a complete answer on dealing with the status bar in iOS 7 : http://stackoverflow.com/a/20594717/1869369 – Ronny Webers Dec 15 '13 at 19:14
  • possible duplicate of [Cannot hide status bar in iOS7](http://stackoverflow.com/questions/18059703/cannot-hide-status-bar-in-ios7) – Praveen Mar 24 '14 at 14:27

5 Answers5

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.

Kavu
  • 7,886
  • 3
  • 34
  • 39
tausun
  • 2,154
  • 2
  • 24
  • 36
  • 9
    Just in case you can't find UIViewControllerBasedStatusBarAppearance, it appears as "View controller-based status bar appearance". – enreas Apr 10 '14 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. – John Pavley Aug 16 '14 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.

Marcelo
  • 9,916
  • 3
  • 43
  • 52
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.

LuisEspinoza
  • 8,508
  • 6
  • 35
  • 57
2
// for ios 7 
- (BOOL)prefersStatusBarHidden
{
    return YES; 
}


// for ios 6
- (void)viewWillAppear:(BOOL)animated 
{
    [super viewWillAppear:animated];
    [[UIApplication sharedApplication] setStatusBarHidden:YES]; 
}
Darshit Shah
  • 2,366
  • 26
  • 33
0

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

UIStatusBarHidden boolean value YES.

Maverick King
  • 85
  • 1
  • 10