This code can change color of a UINavigationBar everywhere within the application. However, I noticed that it does not change the UIColor of the UINavigationBar used by UINavigationController (mine comes from a UIStoryboard).
UIColor* navBarColor = [UIColor colorWithRed:arc4random()%100/100.0
green:arc4random()%100/100.0
blue:arc4random()%100/100.0
alpha:1];
[[UINavigationBar appearance] setTintColor:navBarColor];
[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent];
[[UINavigationBar appearance] setAlpha:0.7];
Is there a way to access the appearance object of a UINavigationController's navigation bar? I know how to set tints of individual controllers, but I want to have a global control over how they look.
Update:
This was my mistake, the code does change the UIColor of all UINavigationBars, but it requires the root navigation controller to be covered and uncovered(for example presenting a modal view controller), then it will re-draw itself with new UIColors!
Thank you!
The complete solution which changes the navbar color instantly and remembers the preference for subsequent launches can be found here:
iPhone iOS how to redraw UINavigationBar on demand?