How do you hide the status bar in ios 9?
This is now deprecated:
[UIApplication sharedApplication] setStatusBarHidden:YES];
How do you hide the status bar in ios 9?
This is now deprecated:
[UIApplication sharedApplication] setStatusBarHidden:YES];
If for some reason you need
View controller-based status bar appearance
equal toYES
(for example to keep status bar white)on AppDelegate's
didFinishLaunchingWithOptions
method or wherever you setup your navigationController:then use alex-staravoitau's awesome answer and add this code wherever you'll be hiding the status bar:
I'm not sure if this is the right way to achieve this result, but it worked for me and I hope it helps someone else too :)
Here's how do you easily return a control over status bar visibility for iOS 9+ and Swift 3+:
View controller-based status bar appearance
key withYES
value toInfo.plist
.Add this variable to the view controller:
Override
prefersStatusBarHidden
property:That's it. Now you are able to call
isStatusBarHidden = true
andisStatusBarHidden = false
whenever you want.An easy approach would be to set the
windowLevel
of the Application to be either normal or statusBar based on your needs, so to startTo Hide the Status Bar
To Show the Status Bar
Also add the
Key
(View controller-based status bar appearance) with boolean value NO.In most of the iOS it will work. I have tested with iOS 10.
in info.plist add the following two property.
I know that the documentation of
setStatusBarHidden:
does not mention on what use instead. But the header ofUIApplication
does.Here is stated that you should use the
prefersStatusBarHidden
onUIViewController
and use view controller based statusbar styles.All you need to do now is configure whether the view controller needs to show of hide the status bar. Like so :