Kelly
Kelly

Reputation: 145

How to Change Navigation Bar Color

I need give a custom color to my navigation bar.But I am not intended to use an image.Is there any way to change the navigation bar color other than using an image.Please help. Thanks in advance.

Upvotes: 2

Views: 3759

Answers (3)

Ali Farhan
Ali Farhan

Reputation: 199

navBar.navigationBar.barTintColor = [UIColor blueColor];  
// barTintColor sets the background color

navBar.navigationBar.tintColor = [UIColor whiteColor];  
// tintColor sets the buttons color of the navigation bar

navBar.navigationBar.translucent = NO;

Upvotes: 2

Muhammad Zeshan Mazhar
Muhammad Zeshan Mazhar

Reputation: 445

In objective C and In IOS 7 navigation bar has a property

barTintColor

in your view controller.h file make a property of your navigationbar like this.

@property (weak, nonatomic) IBOutlet UINavigationBar *mynavbar;

And in your viewcontroller.m file call that this method change your navigationbar color.

mynavbar.barTintColor=[UIColor groupTableViewBackgroundColor];

thanks in advance.

Upvotes: 0

Sree
Sree

Reputation: 907

You can use RGB values to make a color and can set it to your navigation bar.

yourNavigationController.navigationBar.tintColor = [UIColor colorWithRed:0.31 green:0.66 blue:0.83 alpha:1.00];

Upvotes: 4

Related Questions