-2

I am able to change tho color of NavigationBar by giving BackgroundColor but than I am not able change the color of StatusBar. Please provide a solution.

Champz
  • 11
  • 3

1 Answers1

0

You should change the barTintColor instead of the background color.

[self.navigationController setBarTintColor:[UIColor redNavigationBarColor]];

Chances are that you will probably need to change also the barButton color and/or the the title color and all that should probably apply to more than one screen. So, to save you some time, if you want to globally change all these, put the code below in your app delegate

[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

The code above will give you a red navigation bar with white title & buttons

Pantelis Proios
  • 1,359
  • 1
  • 20
  • 32
  • I tried doing that but still no change. I am only able to see the default Color of Navigation Bar. – Champz Oct 01 '15 at 12:20
  • Add the code above in the app delegate. If you do that, there is no chance not t work. Ah, and make sure that your view controller is under a navigation controller – Pantelis Proios Oct 01 '15 at 12:41