2014-01-17 190 views
0

我正在嘗試將導航欄的顏色更改爲Iphone應用程序。NavBar顏色ios 7

它適用於iOS 6,但它確實沒有在iOS 7

我已閱讀,在iOS 7喲必須設置色調,而不是背景,這就是我所做的。

enter image description here

enter image description here

任何線索?只要你想

在此先感謝

回答

1
NSArray *ver = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."]; 
if ([[ver objectAtIndex:0] intValue] >= 7) { 
    self.navigationController.navigationBar.barTintColor = [UIColor redColor]; 
    self.navigationController.navigationBar.translucent = NO; 
}else { 
    self.navigationController.navigationBar.tintColor = [UIColor redColor]; 
} 
+0

謝謝!有用!但現在我有另一個問題。按鈕默認爲紅色,現在顯然它們不可見。我是否必須親手改變他們的風格?或者有沒有辦法獲得「紅酒吧風格」或什麼? – Andoxko

+1

如果你的按鈕只是不是標籤類型,然後創建自定義UIButton和創建UIBarbutton並添加到您的導航欄 – Retro

+0

我可以做什麼用默認後退按鈕?自己創建它? – Andoxko

0

試試這個,改變顏色。

if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) { 
    [UINavigationBar.appearance setTintColor:[UIColor redColor]]; 
    [UIToolbar.appearance setTintColor:[UIColor redColor]]; 
}else{ 
    [UINavigationBar.appearance setBarTintColor:[UIColor redColor]]; 
}