-1

How do I change the color on the top of nav bar? Not really sure what that part is called, so apologies if the title of this question is therefore inaccurate

enter image description here

user3395936
  • 651
  • 3
  • 13
  • 26
  • Possible duplicate of [Changing the Status Bar Color for specific ViewControllers using Swift in iOS8](http://stackoverflow.com/questions/26956728/changing-the-status-bar-color-for-specific-viewcontrollers-using-swift-in-ios8) – JAL Mar 13 '16 at 22:27

1 Answers1

0

You are referring to the status bar.


You can change it between dark and light with a single line of code (Apple only would like you to do white or black, I believe).

In your viewdidload():

For a black status bar: UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.Default

For a white status bar: UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent


You can also hide the status bar and put your own custom thing there, by putting this code snippet after your viewdidload:

override func prefersStatusBarHidden() -> Bool {
return true
}

I hope this helps you!

owlswipe
  • 19,159
  • 9
  • 37
  • 82