Change color of Back button in navigation bar
I am trying to change the color of the Settings button to white, but can't get it to change.
I've tried both of these:
navigationItem.leftBarButtonItem?.tintColor = UIColor.whiteColor()
navigationItem.backBarButtonItem?.tintColor = UIColor.whiteColor()
but no change, it still looks like this:
How do I make that button white?
Solution 1:
You can change the global tint color in your storyboard by clicking on an empty space on the board and select in the right toolbar "Show the file inspector", and you will see in the bottom of the toolbar the "Global Tint" option.
Solution 2:
This code changes the arrow color
self.navigationController.navigationBar.tintColor = UIColor.whiteColor();
If this does not work, use the code below:
self.navigationBar.barStyle = UIBarStyle.Black
self.navigationBar.tintColor = UIColor.whiteColor()
Swift 3 Notes
UIColor.whiteColor()
and similar have been simplified to UIColor.white
Also, many previously implicit optionals have been changed to explicit, so you might need:
self.navigationController?.navigationBar =
Solution 3:
Very easy to set up in the storyboard: