2015-04-28 90 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]]; 
設置的顏色值彈起視圖控制器