Hello,
I created UINavigationBar, and I try to change the color bar to aqua color (As in Nib file)
How do I do it?
You can set either tintColor or backgroundImage to your UINavigationBar
- (void) viewDidLoad
{
//set background image
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"background.png"]];
//OR set background Color
[self.navigationController.navigationBar setTintColor:[UIColor blueColor]];
}
I'm not sure but if you'll put this in first call method of your app it may apply everywhere!
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { }
AQUA (RGB). Use mac in-built DigitalColor Meter and hover the cursor from which you want RGB and set the color code. You've to set RGB like, e.g. 125.0/255.0UINavigationBar *bar = [self.navigationController navigationBar];
[bar setTintColor:[UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0]];
Please try above code for set color.
Edited
UINavigationBar *bar = [self.navigationController navigationBar];
UIColor* aqua = [UIColor colorWithRed:0 green:1 blue:1 alpha:1];
[bar setTintColor:aqua];
This Code use for the aqua color
[self.navigationController.navigationBar setTintColor:[UIColor blueColor]];
Call this function befor the ViewController will appear, e.g. in viewDidLoad: