Hide Status Bar in iPhone application, or change it’s style

What do you do to hide the status bar in iPhone application. If you build your views in Interface builder, you can set the status bar to None, but notice that above status bar menu it says: Simulated Interface Elements. That means, that it will only show a change in Interface Builder but not in a compiled application.

You have two options to hide the status bar, one is by editing info.plist file you have (typically in Resources Group). You can either open it up in TextEdit (or any other text editor) and add this value under dict XML tag:

<key>UIStatusBarHidden</key>
<true />

Other option is to open info.plist file by double clicking it and adding a new variable to the Information Property List. And under key type (or select from drop down menu) Status bar is initially hidden and check the checkbox (thus setting it’s property to true).

Last option is to do it programmatically inside one of your classes by:

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

By changing BOOL value of setStatusBarHidden to NO, you are able to show the hidden status bar:

[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];

If you want to change the style of iPhone status bar you can once again edit info.plist and add for Opaque black style the following:

<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>

for Transparent black style (alpha of 0.5) add:

<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackTranslucent</string>

Again you can add status bar style by double clicking info.plist and selecting from dropdown menu Status bar style as Key and selecting prefered style as the value (again from the dropdown).

Advertisements

,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: