FS.O6 FS.O6 - 11 months ago 73
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?


Answer Source

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