Umair Afzal Umair Afzal - 27 days ago 11x
Swift Question

Hide status bar even when an alert is presented

I am hiding my status bar on a specific


override func prefersStatusBarHidden() -> Bool {
return true

It is working very nice until I present an alert on the screen. When alert is presented status bar appears again, Which I do not want. When alert is dismissed status bar is hidden again.


As UIAlertController is now a full-fledged UIViewController, you should be able to subclass it and add the same method to the new subclass. Then instanciate your subclass instead of a plain UIAlertController.

Untested, but that should do the trick.