FS.O6 FS.O6 - 27 days ago 13
Swift Question

Adding white status bar

I'm trying to add a white status bar to my ViewController like that:

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}


but it doesn't work in most of the views (it worked on some)

Any idea how to make it work?

Thanks!

Answer

Subclass UINavigationController as below. Then in interface builder set the class of your navigation controller to "MyNavigationController.

class MyNavigationController: UINavigationController {
  override func preferredStatusBarStyle() -> UIStatusBarStyle {
  return .LightContent
  }
}
Comments