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!
Best Answer
You need to override this method on each view controller unless you have that plist entry.
Objective-C
Swift 2
Swift 3+
And don't forget to set (if you present a view controller by calling the presentViewController:animated:completion: method):
Objective-C
Swift
Documentation: https://developer.apple.com/reference/uikit/uiviewcontroller/1621453-modalpresentationcapturesstatusb
If you change status bar from some container view controller (eg.
UINavigationController
orUIViewController
with child view controllers) and you would like to change view controller responsible for status bar you should usechildViewControllerForStatusBarHidden:
property. Eg:Set first view controller instance always responsible for status bar management
Objective-C
Swift 2
Swift 3+
Set container view controller responsible for status bar management
Objective-C
Swift 2
Swift 3+
Documentation: https://developer.apple.com/documentation/uikit/uiviewcontroller/1621451-childviewcontrollerforstatusbarh