Gotcha: Hiding the Status Bar

Okay, so this is a well-worn topic. However, there are a few potential gotchas that are worth visiting.

To begin, if you want to hide the status bar in a running application, it’s quite simple – this technique is handy for things that are best shown fullscreen, for example, I used this technique when previewing images for an iPhone wallpaper app so users could see the entire image with no scaling.

Hiding the status bar is as easy as:

[[UIApplication sharedApplication] setStatusBarHidden:YES];

Gotcha #1
If you want to set the status bar to hidden at application startup, if you attempt to use the above line inside the applicationDidFinishLaunching method, the status bar will be shown while your application is loading, then it will quickly disappear. Not a good thing.

The trick is to set the UIStatusBarHidden property in the application file. This property needs to be set to true inside the property list, the trick is, you have to be sure that the property is saved as a boolean. The reason this can be troublesome is that that are a number of ways to look at the property list file within Xcode. If you right click the info.plist file, you’ll see the dialog below, showing the options.

I was recently editing the value of info.plist as an XML property list and clicked on the + on the far right to add a new entry. In a hurry, I entered the UIStatusBarHidden and set its value to true as shown below:

Gotcha #2
Problem is, this sets the value of UIStatusBarHidden to a string value. Look at the info.plist file as a plain text file and you’ll see the problem:

UIStatusBarHidden needs to be saved as a boolean. To fix this problem, change the property list entry to look as follows:

And when you return to editing your property list file as an XML property list, the boolean value will now been shown as:

And there you have it, more than you ever wanted to know about hiding the status bar.

  1. I don’t see the latter issue you describe. I just tried it in 3.0, and when I went to the plist, it came up with UIStatusBarHidden as a checkbox. Have you moved on to 3.01 Beta (or whatever the number is)?

    • Hi Michelle,

      When using the drop down to add a new entry, for example, selecting Status bar is initially hidden will present a checkbox. However, I was manually typing in UIStatusBarHidden, which means I also had to enter the value on the right side, where I entered “true” which was then stored as a string (versus a boolean).


  2. Just a quick tip:
    Right-click on the row you created in Plist Editor and simply change it’s type to boolean.
    So you don’t have to mess around with the XML.

    Anyway, nice tip :).

  3. Massive props for this post. I did the XML route using Xcode 4. When I went to look at it as a list it was set to YES afterwards.

    Thanks again,

  4. In XCode 4.2 (and probably other versions of 4) you can just click the info.plist so it opens inside XCode. Then right-click anywhere inside the plist file and choose ‘Add Row’.

    The row to add is called ‘Status bar is initially hidden’ and is available from the dropdown ‘Key’ list.

  5. Hi. THANK YOU very much for this post. This makes the launch screen appear better without that status bar.

  6. How does one resize a view after they SHOW the status bar? I have an APP where I want one view to have the status bar and the other views to have it hidden.

Comments are closed.