2

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.

vzm
  • 2,440
  • 6
  • 28
  • 47

7 Answers7

6

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.

vzm
  • 2,440
  • 6
  • 28
  • 47
5

To hide status bar:

if [View controller-based status bar appearance: NO]: in AppDelegate.m call

[[UIApplication sharedApplication]setStatusBarHidden:YES];

else: in every view controller

- (BOOL)prefersStatusBarHidden
{
    return YES;
}
Wubao Li
  • 1,728
  • 10
  • 13
  • I tried this, but it does not work for me, please see updated post – vzm Nov 07 '13 at 21:24
  • show more code in your second view. Maybe some code change the status bar hidden property indirectly. – Wubao Li Nov 08 '13 at 09:13
  • [[UIApplication sharedApplication]setStatusBarHidden:YES]; worked for me. Thought I have set View controller-based status bar appearance: NO already – Ans Apr 22 '14 at 22:15
2

Use this method in the View Controller which you'd like the Status Bar hidden:

- (BOOL)prefersStatusBarHidden {
    return YES;
}
Guto Araujo
  • 3,824
  • 2
  • 21
  • 26
2

Try this 2 steps:

  1. In .Plist file of project set the property:

View controller-based status bar appearance = NO;

and 2.In all view controller's .m file in viewDidLoad method put this line of code:

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

This should work :

// In iOS7 this gets called and hides the status bar so the view does not go under the top iPhone
// status bar

- (BOOL)prefersStatusBarHidden {
      return YES;
}
Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
0

none of these work for me. when i try this method i get the message "use of undeclared identifier preferstatusbarHidden

include - (BOOL)prefersStatusBarHidden {
      return YES;
}
vboombatz
  • 409
  • 6
  • 17
0

I don't know what to do anymore. I tried setStatusBarHidden, prefersHiddenStatusBar and still no results. Finally i have went through the below you tube link :

https://www.youtube.com/watch?v=FtpBXdMSqRQ

It worked for me.

user2786
  • 656
  • 4
  • 13
  • 35