This question might be very easy to answer so I apologize if I missed the obvious.
I'm developing a GUI application on the iPhone and want to hide the title/status bar of the iPhone which usually displays the carrier/time/battery.
How can I do this from within the code given the main UIWindow and UIView?
-A
In your Info.plist file, set UIStatusBarHidden
to true or add the following to your application delegate:
[[UIApplication sharedApplication] setStatusBarHidden:YES];
The answers above are deprecated. The right way to do this programmatically is now:
[[UIApplication sharedApplication] setStatusBarHidden:YES
withAnimation:UIStatusBarAnimationNone] ;
If you want you could use UIStatusBarAnimationFade
or UIStatusBarAnimationSlide
instead of UIStatusBarAnimationNone
prefersStatusBarHidden
Specifies whether the view controller prefers the status bar to be hidden or shown.
- (BOOL)prefersStatusBarHidden
{
return YES;
}
UIViewController Class Reference
https://developer.apple.com/library/ios/Documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/prefersStatusBarHidden
As at writing of this replies, Xcode 4.1, just use the following:
[[UIApplication sharedApplication] setStatusBarHidden:TRUE];
will not have white space at the top.
alternatively, the plist entry is:
"Status bar is initially hidden"