Reputation: 7489
I have some drops downs in a view controller and when they drop down I'd like to hide the status bar. I know this is how we do it in a vc:
override func prefersStatusBarHidden() -> Bool {
return true
}
But what about from inside a function?
Upvotes: 0
Views: 213
Reputation: 451
Add an instance variable to your view controller class var statusBarHidden = false
and override prefersStatusBarHidden
to return statusBarHidden
.
override func prefersStatusBarHidden() -> Bool {
return statusBarHidden
}
Then any time you need to hide/show the status bar, use the following code snippet:
statusBarHidden = !statusBarHidden
setNeedsStatusBarAppearanceUpdate()
Upvotes: 2
Reputation: 300
I think it's UIApplication.sharedApplication().statusBarHidden=true
but it's off the top of my head.
Upvotes: 0