user1680822 user1680822 - 4 months ago 6x
iOS Question

How to hide a status bar in iOS?

I can hide a status bar in my app:

- (void)viewDidLoad{
[[UIApplication sharedApplication] setStatusBarHidden:YES];
[super viewDidLoad];

When I chose my launch image and start it first time, it's status bar over a picture. How can I hide this?


Add the following code to your view controller:

if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
    // iOS 7
    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
    // iOS 6
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];

- (BOOL)prefersStatusBarHidden {
    return YES;