I have had the following code:
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navbarBackBlack.png"] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navbarBackBlack.png"] forBarMetrics:UIBarMetricsLandscapePhone];
[[UINavigationBar appearance] setTintColor:[UIColor colorWithWhite:0.72 alpha:1.0]];
But now I want to have one place in my app where I want the navbar to be a different color than this universal color I've set throughout the app. How can I change this for this particular settings only. Is it possible?
You can call setBackgroundImage on the instance of the navigation bar as well.
See this related post:
Custom UITabBar background image not working in iOS 5 and later
You should also condition it on whether it responds to that selector:
if ([navBar respondsToSelector:@selector(setBackgroundImage:)])
{
[navBar setBackgroundImage:[UIImage imageNamed:@"tabbar_brn.jpg"]];
}
else
{
// ios 4 code here
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With