2015-04-28 93 views
0

在我们的应用程序中,我们使用以下代码设置导航栏和工具栏颜色。使用iOS 8.x,这工作正常。最近我使用iOS 7.x测试了应用程序,并且颜色未显示。酒吧是透明的,文字有白色(所以这工作...)iOS PopoVer NavigationBar不显示BarTintColor

- (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]]; 

我希望有人能解释我如何解决这个问题。设置条形背景色对我来说不是解决方案,因为我会使用透明度。

回答

0

解决这个问题再次手动为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]]; 
设置的颜色值弹起视图控制器