FS.O6 FS.O6 -4 years ago 206
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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download