Status bar is a tiny rectangle ( 320 x 20 px) on top of your screen, showing you you carrier’s name, range, time and battery status.
![]()
This part is very useful while developing applications – utilities, but as far as I remember, when I started programming I was really confused how to hide it.
While designing the view in Interface Builder in view’s attributes tab you can set Status Bar = None, but it’s still there. Nothing will happen if you set Status Bar property for MainWindow.xib.
If you would like to get rid of status bar you must do it in Xcode. It’s just a single line of code:
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
- (void)applicationDidFinishLaunching:(UIApplication *)application { MyView *viewController = [[MyView alloc] initWithNibName:@"MyView" bundle:[NSBundle mainBundle]]; [window addSubview:[viewController view]]; // Override point for customization after application launch [window makeKeyAndVisible]; }
Status bar’s styles
By default status bar is gray – shown as an image example above. You can quickly change it, so it will be like in Springboard (black) or during YouTube video playback (black translucent – showing what’s behind him).
![]()
![]()
Code:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:YES]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
As before using animated boolean property you can change the status bar with transition or without.
Orientation
There is another article about handling interface autorotation, but changing the status bar orientation is easy.
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft animated:YES]; [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:YES]; [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:YES]; [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortraitUpsideDown animated:YES];
Please note: Using iPhone Simulator changing the orientation of status bar, automatically turn the defice to landscape / portrait mode, without changing the interface orientation (how to handle this, I will present in another tutorial).
That’s it. Sample project for you.

