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];
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 plist.info 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:
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.