3

I tried to set navigation bar colour to black in iOS 7 using

[self.navigationController.navigationBar setTintColor:[UIColor blackColor]];

using this not working

but some times works but all the other bar buttons remains in black, which cause not able to see the bar buttons

user2732294
  • 641
  • 2
  • 10
  • 21

2 Answers2

7

Check Apple document , you got info

Default navigationBar in iOS7 is translucent and its background control by barTinColor

So to make your navigationBar black like iOS6, you can do

[self.navigationController.navigationBar setTranslucent:NO];

[self.navigationController.navigationBar setBarTintColor:[UIColor blackColor]];

Or

[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackOpaque];
LE SANG
  • 10,955
  • 7
  • 59
  • 78
  • [self.navigationController.navigationBar setBarStyle:UIBarStyleBlackOpaque]; This works fine for set color but, back button & navigation bar button items are not visable they are in their default color black – user2732294 Sep 25 '13 at 14:43
  • Maybe you setTinColor to black ? TinColor now use for BarItem in iOS7, just delete setTinColor in your code or set it to different color – LE SANG Sep 25 '13 at 14:48
3

In iOS7:

[self.navigationController.navigationBar setBarTintColor:[UIColor blackColor]];

Léo Natan
  • 56,823
  • 9
  • 150
  • 195
  • This works for me, but makes the time and the battery black so you can't see it anymore. Why? – TheJeff Aug 29 '16 at 23:46
  • That's because you need to set he status bar style to light content. Set the style of the navigation bar to black, and it will happen automatically. – Léo Natan Sep 01 '16 at 15:26