In a ViewController, which I presented modally, I did this:
override func prefersStatusBarHidden() -> Bool { return true }
This used to work, but it no longer works. What's the best way to hide the status bar only for this view controller?
To completely hide it on the home screen, open up an app, such as Settings, and wait about three to four seconds. Press the home button again, and the status bar will be completely gone.
step 1 : in your frameWork-Info. plst' file, add the key 'View controller-based status bar appearance' and set it to 'NO'.
For Swift 3 & Swift 4 it has changed to overriding a variable like this:
override var prefersStatusBarHidden: Bool { return true }
If you want to "Update" the state once the view controller is already being displayed, you will need to call:
setNeedsStatusBarAppearanceUpdate()
Please refer to the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With