As explained in the official Apple documentation, the status bar displays important information about the device and the current environment
First of all:
The status bar always appears at the upper edge of the device screen (in all orientations) and contains information people need, such as the network connection, the time of day, and the battery charge.
Then let's read some important guidelines from Apple:
Although you don’t use the status bar in the same way that you use other UI elements, it’s important to understand its function in your app.
– Think twice before hiding the status bar if your application is not a game or full-screen media-viewing application. Although these apps might permanently hide the status bar, you should understand the ramifications of this design decision. Permanently hiding the status bar means that users must quit your app to find out, for example, whether they need to recharge their device.
– Consider hiding the status bar while people are actively viewing full-screen media.
– Don’t create a custom status bar. Users depend on the consistency of the system-provided status bar. Although you might hide the status bar in your app, it’s not appropriate to create custom UI that takes its place.
Now let's start modifing the Status Bar
On iPhone, the status bar can have different colors while on iPad, the status bar is always black. So on iPhone you can specify the color of the status bar, there are three colors available:
- gray (default)
- opaque black
- translucent black (alpha =.5)
To programmatically set the status bar style, you can do the following.
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
To programmatically hide the status bar you can do the following:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:theChoosenAnimation];
Each of the above values applie a different animation when you are hiding the status bar.