Trevor Wood Trevor Wood - 1 year ago 76
iOS Question

How do I change the color of the status bar in an iPhone app?

How can I change the color of the header section in an iPhone App. The part with the carrier, time, and battery.

This part

enter image description here

More specifically, this part. I'd like to change the UI from black, to white or an easier to see color.

enter image description here

Answer Source

To change the navigation bar color:

navigationController!.navigationBar.barTintColor = UIColor.blueColor()

To change the text in the navigation bar:

navigationController!.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.yellowColor()]

To change the status bar:

  1. Go to your info.plist and add the following key View controller-based status bar appearance and set the value to NO
  2. In you viewControllers viewDidload do set

White bar:
UIApplication.sharedApplication().statusBarStyle = .LightContent

Dark bar:
UIApplication.sharedApplication().statusBarStyle = .Default

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download