Sunday, June 9, 2013

UINavigationBar tintColor example in Objective C (iOS).

UINavigationBar tintColor

The color used to tint the bar.

@property(nonatomic, retain) UIColor *tintColor

Discussion of [UINavigationBar tintColor]
The default value is nil.

It is permissible to set the value of this property when the navigation bar is being managed by a navigation controller object.

UINavigationBar tintColor example.
Set the barStyle to UIBarStyleBlackTranslucent Set the tintColor like this:

navigationBar.tintColor = [UIColor colorWithRed:.7 green:.5 blue:.2 alpha:1];
This will set the appropriate gradient. Use whatever combination you need.

Example of [UINavigationBar tintColor].
That is one way of doing it. It would probably just be easier in you ViewController where ever you need to change it add the line:

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

UINavigationBar tintColor example.
- (void)viewWillAppear:(BOOL)animated
    [super viewWillAppear:animated];
    tintBarColor = [UIColor  
    self.navigationController.navigationBar.tintColor = tintBarColor;

- (void)viewDidUnload
    [super viewDidUnload];
    [tintBarColor release];
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on     demand.
    // For example: self.myOutlet = nil;

End of UINavigationBar tintColor example article.