11

Is there a way to change only the left side back button color in an app with a navigation controller?

There are plenty of examples changing colors in the navbar but those all affect the navbar title as well. I don't want to change the title. Just the back button (text + chevron) color.

4thSpace
  • 43,672
  • 97
  • 296
  • 475
  • 1
    Possible duplicate of [Change color of Back button in navigation bar](https://stackoverflow.com/questions/28733936/change-color-of-back-button-in-navigation-bar) – Yuki Inoue Dec 04 '17 at 10:15

3 Answers3

25

Use Below To Change Back Button Color:

navigationController?.navigationBar.tintColor = UIColor.red

To Change Title Color of The Navigation Bar Use:

navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red]
Bhargav Kukadiya
  • 418
  • 7
  • 17
1
 UINavigationBar.appearance().backgroundColor = UIColor.greenColor()

UIBarButtonItem.appearance().tintColor = UIColor.magentaColor()

Since iOS 7.0 UITextAttributeTextColor was replaced by NSForegroundColorAttributeName

UINavigationBar.appearance().titleTextAttributes = [UITextAttributeTextColor: UIColor.blueColor()]
UITabBar.appearance().backgroundColor = UIColor.yellowColor();
Mr. Bond
  • 427
  • 1
  • 4
  • 18
0
override func viewDidLoad() {
    super.viewDidLoad()

    self.navigationController?.navigationBar.tintColor = UIColor.white
    self.navigationController?.navigationBar.barTintColor = UIColor.black
    self.navigationController?.navigationBar.titleTextAttributes = UIColor.blue
}
Deepak Tagadiya
  • 2,187
  • 15
  • 28