Dhaval
Dhaval

Reputation: 301

Hiding status bar iOS 7

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

Upvotes: 30

Views: 26291

Answers (5)

tausun
tausun

Reputation: 2160

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.

Upvotes: 84

Darshit Shah
Darshit Shah

Reputation: 2382

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


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

Upvotes: 2

Maverick King
Maverick King

Reputation: 85

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

UIStatusBarHidden boolean value YES.

Upvotes: 0

LuisEspinoza
LuisEspinoza

Reputation: 8538

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.

Upvotes: 4

Marcelo
Marcelo

Reputation: 9944

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.

Upvotes: 4

Related Questions