Reputation: 4589
The documentation on hiding status bar says that I should implement this method
override prefersStatusBarHidden(){
return true
}
and than it says: If you change the return value for this method, call the setNeedsStatusBarAppearanceUpdate
method. When should I call this method, in viewDidLoad, in prefersStatusBarHidden or somewhere else?
Upvotes: 4
Views: 4634
Reputation: 4676
In most cases you don't need to call setNeedsStatusBarAppearanceUpdate()
at all. When your view controller appears or disappears iOS checks prefersStatusBarHidden()
automatically.
You only need to call setNeedsStatusBarAppearanceUpdate()
when the value returned by prefersStatusBarHidden()
changes while your view controller is visible.
Upvotes: 6