Search code examples
iosobjective-cios7uinavigationbarstatusbar

How to hide status bar in iOS 7?


I have tried setting the following in my app .plist file:

View controller-based status bar appearance: NO

And while this removes it from my initial view controller, once I go to another view and come back with my navigation controller, it comes right back and this time it does not disappear. Also, I don't see why it would matter but I have also set the status bar under simulated metrics to "None" but that doesn't seem to help. I know i am going to have the navigation bar but the status bar I need gone.

enter image description here

How can I get this done? Please provide a detailed answer, sample code would be great!

Update: This is NOT a duplicate solution as I have tried all other solutions and NONE seem to work for me. Most recently I tried

[[UIApplication sharedApplication]setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

Again, with no results. When the app initially launches a status bar is NOT present, after the user visits another view, the status bar is now present in the 2 and other views and does not go away. Even if you go back to the main view.


Solution

  • I have tried all of the suggestions that were posted here, unfortunately what happened here was a small mistake, in my viewDidLoad I had:

    [[UIApplication sharedApplication] setStatusBarHidden:YES];

    But in my viewWillAppear I had:

    [[UIApplication sharedApplication] setStatusBarHidden:NO];

    So this was just an issue of overriding, problem fixed now.