Search code examples
uinavigationbaruitoolbartintbartintcolor

iOS PopoVer NavigationBar don't show BarTintColor


In our app we're setting the navigationbar and toolbar color with the following code. With iOS 8.x this is working fine. Recently I have tested the app with iOS 7.x and the colors aren't shown. The bars are transparent and the text has white color (so this worked...)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:255.0/255.0 green:167.0/255.0 blue:0.0/255.0 alpha:1.0]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

[[UIToolbar appearance] setBarTintColor:[UIColor colorWithRed:255.0/255.0 green:167.0/255.0 blue:0.0/255.0 alpha:1.0]];
[[UIToolbar appearance] setTintColor:[UIColor whiteColor]];

[[UINavigationBar appearance] setTitleTextAttributes:
 [NSDictionary dictionaryWithObjectsAndKeys:
  [UIColor whiteColor], NSForegroundColorAttributeName,
  [UIColor clearColor], UITextAttributeTextShadowColor,
  [NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset,
  [UIFont boldSystemFontOfSize:19.0], NSFontAttributeName,
nil]];

I hope somebody could explain me how to solve this. Setting the bars background color is no solution to me because i would use transparency.


Solution

  • The solution to this issue is to set the color-values manually in the popping-up ViewController again for iOS 7.

    self.navigationController.toolbar.barStyle = UIBarStyleBlackTranslucent;
    [self.navigationController.toolbar setTintColor:[UIColor whiteColor]];
    [self.navigationController.toolbar setBarTintColor:[UIColor colorWithRed:255.0/255.0 green:167.0/255.0 blue:0.0/255.0 alpha:1.0]];
    
    self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; 
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:255.0/255.0 green:167.0/255.0 blue:0.0/255.0 alpha:1.0]];