SJBur
SJBur

Reputation: 35

Can't change tint color of UINavigationController


I started using UINavigationController in My project and there is a problem : I can set the barTintColor, but the tintColor is doesn't changing, always black...
So, the code :

- (void)viewDidLoad
    {
        [super viewDidLoad];
        // Do any additional setup after loading the view.

        self.navigationBar.tintColor = [UIColor whiteColor];
        self.navigationBar.barTintColor = [UIColor colorWithRed:(95/255.0) green:(136/255.0) blue:(180/255.0) alpha:(255.0)];
    }

NEW : Hey, maybe my english is not good, but I'll repeat : I can't set the TINTCOLOR, not the barTintColor!

Upvotes: 0

Views: 2683

Answers (3)

Michael Ortiz
Michael Ortiz

Reputation: 777

Here you go sir. Just put this in your viewDidLoad method.

self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:(95/255.0) green:(136/255.0) blue:(180/255.0) alpha:1];

self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];

Upvotes: 3

Alejandro
Alejandro

Reputation: 379

I use

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

You must set it in the navigation controller, not directly in the navigation bar, so it affects all the view controllers inside the navigation controller.

Upvotes: 0

Ankit Chauhan
Ankit Chauhan

Reputation: 2405

Try..

[self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:106/255.0f green:195/255.0f blue:255/255.0f alpha:1.0]];

Upvotes: 1

Related Questions