Aggressor Aggressor - 6 months ago 67
Objective-C Question

Hide Status Bar In iOS 8 app

I have tried

[[UIApplication sharedApplication] setStatusBarHidden:YES];


This does nothing.

And I have looked in my
Info.plist
file for "View controller-based status bar appearance" but it's not there.

How can I hide the white status bar at the top of the screen (with the clock and battery charge) inside my app for Xcode 6? Thank you!

Answer

You need to override this method on each view controller unless you have that plist entry.

Objective-C

-(BOOL)prefersStatusBarHidden{
    return YES;
}

Swift

override func prefersStatusBarHidden() -> Bool {
    return true
}