0

I have set a color of my Navigation bar in Appdelegate so my app uses same color for all the navigation appearing in different screens. But Now for one or two controllers I want to change the navigation color. I used this code in viewDidLoad of specific controller but It isn't working

self.navigationController?.navigationBar.backgroundColor = UIColor.whiteColor()

I have tried this code in viewWillAppear function too but still it doesn't work

hellosheikh
  • 2,929
  • 8
  • 49
  • 115
  • Possible duplicate of [How to change Navigation Bar color in iOS 7?](http://stackoverflow.com/questions/18929864/how-to-change-navigation-bar-color-in-ios-7) – Stephen Feb 03 '16 at 21:28

2 Answers2

1

The property you are looking for is not backgroundColor, but rather barTintColor.

self.navigationController?.navigationBar.barTintColor = UIColor.whiteColor()
Luke
  • 11,426
  • 43
  • 60
  • 69
Stephen
  • 1,154
  • 11
  • 27
0

Please use tint color

  [nav.navigationBar setBarTintColor:[UIColor blueColor]];
David Yang Liu
  • 1,170
  • 2
  • 10
  • 19
  • Thank you very much. well As I am working on swift so I can't mark your answer correct But I know you were the first answering the right solution – hellosheikh Feb 03 '16 at 21:30