Trevor Wood Trevor Wood - 6 months ago 32
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


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