Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add custom color to navigation bar in iphone?

How do I set the navigation bar to a custom color (e.g. dark green) ?

I know how to change the navigation bar to primary colors like green and red, using code like this:

UINavigationBar *bar = [self.navigationController navigationBar]; 
[bar setTintColor:[UIColor redColor]]; 

Thanks.

like image 685
Rani Avatar asked Apr 07 '11 07:04

Rani


People also ask

Can you change Iphone navigation bar?

A user changes the navigation bar's style, or UIBarStyle , by tapping the “Style” button to the left of the main page. This button opens an action sheet where users can change the background's appearance to default, black-opaque, or black- translucent.

How do I customize my navigation bar?

From Settings, tap Display, and then tap Navigation bar. Make sure Buttons is selected, and then you can choose your desired button setup at the bottom of the screen. Note: This option will also affect the location you swipe when using Swipe gestures.


1 Answers

And to change the tint of the navigation bar background :

[self.navBar setBarTintColor:[UIColor colorWithRed:0.701 green:0.926 blue:0.000 alpha:1.000]];
like image 182
Atika Avatar answered Oct 13 '22 00:10

Atika