1

I am trying to set the status bar of my entire iOS app hidden. (The app deployment target is set to iOS 7.1).

I have tried the following (and none worked):

Adding this line to application:didFinishLaunchingWithOptions: in AppDelegate.m :

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

and also this line:

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

I have tried setting the statusBar to None for each of my View Controllers in Storyboard View --> Attributes inspector --> Simulated Metrics.

I have tried adding the key Status bar is initially hidden as YES in Info.plist file of my app.

None of these worked. Can anyone guide me as to what is wrong? Btw, I am using the latest version of XCode on my Mac and latest iOS on my test device. And, all my View Controllers have been set to Landscape mode only in Attributes inspector. And the supported orientations of the app are Landscape both sides.

Roboris
  • 344
  • 3
  • 16

3 Answers3

1

Just set both properties in your .plist file.Then you will be good to go.

1.View controller-based status bar appearance -No

2.Status bar is initially hidden-YES

Hope this will help!

shubham jain
  • 156
  • 1
  • 9
  • For ios 7 ,it should work : float versionOS; versionOS=[[[UIDevice currentDevice] systemVersion] floatValue]; if(versionOS>=7.0) { [UIApplication sharedApplication].statusBarHidden = YES } Add this code into application didFinishLaunchingWithOptions method. – shubham jain Apr 01 '14 at 06:19
0

Have you tried setting:

View controller-based status bar appearance

to NO In your Info.plist file?

Eli Kohen
  • 521
  • 4
  • 8
  • NO, I don't know how to do that. Can you please tell me how? Though I HAVE tried to set it in the Attributes inspector for each of the View Controllers. – Roboris Mar 30 '14 at 18:38
  • In the same way you added the key **Status bar is initially hidden**: Go to your target and then on the **Info** tab, inside **Custom iOS Target properties** add a new row and start typing the key I wrote in my answer. – Eli Kohen Mar 30 '14 at 18:47
  • Tried it. Didn't work. Both with and without the '[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];' line. – Roboris Mar 30 '14 at 18:57
  • I've just created a test project that implements both **[[UIApplication sharedApplication] setStatusBarHidden:YES];** in *application:didFinishLaunchingWithOptions:* and *View controller-based status bar appearance* set to NO in the .plist and it works. I've zipped it, you can download it from here: https://dl.dropboxusercontent.com/u/61562421/StatusBarTest.zip – Eli Kohen Mar 30 '14 at 19:29
0

In your info.plist file, there's a setting called "Status bar is initially hidden." Set that to "YES," and you won't have it at startup. Then you don't need to do anything in your code, the bar will show up when your app is launched.