Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set NavigationBar background to a solid color

Is there any way I can set the background of the Navigation Bar of the UINavigationController to a solid color?

I know I can change the Tint color, but that still leaves me with the gradient/glass effect.

Any way I can get rid of that, and just have a plain old solid color?

like image 638
MartinHN Avatar asked Apr 24 '12 17:04

MartinHN


People also ask

How do I add a background to my navigation bar?

How to change navigation bar color in Bootstrap ? A custom class can be created to specify the background color and the text color of the navbar. This class is styled using CSS according to the required values. The names of the classes are kept in a manner to override the inbuilt navigation bar classes.

How do I make my navigation bar opaque?

Go to attribute inspector of for Navigation bar and remove check mark from translucent.

How do I make my navigation bar black?

To fix this, head into General Settings –> Color of Navigation Bar when Keyboard is opened. Set this color to black as well. This should fix any issues you may have when the keyboard is open. Note that there is also an option to enable coloring of the keyboard simultaneously.


1 Answers

The following code also results in solid color of navigation bar:

[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundColor:[UIColor redColor]];
like image 125
Lubiluk Avatar answered Sep 22 '22 06:09

Lubiluk