Search code examples
iosswiftuiviewcontrollerstatusbar

prefersStatusBarHidden iOS 13 not called


I've always used

override var prefersStatusBarHidden: Bool {return true}

to hide the status bar in a single UIViewController .. But I'm having problems with iOS 13 for this ...

I don't understand why var prefersStatusBarHidden is not called ..

in my plist file I set View controller-based status bar appearance = YES but it doesn't work ...

the status bar is always visible ... how can I solve it?


Solution

  • On an iPhone X-type device (anything without a bezel), Apple does not want you to hide the status bar, so your view controller's prefersStatusBarHidden is not called.

    You may be able to work around this by subclassing UINavigationViewController; in my testing, that worked, but I don't know whether Apple would approve.