2014-04-03 42 views
0

我想設置我的導航欄和狀態欄爲「color5」定製的UIColor我的導航欄

UIColor* color5 = [UIColor colorWithRed: 0.114 green: 0.705 blue: 1 alpha: 1]; 

我做了我的導航欄屬性,並試圖設置着色顏色:

navBar.tintColor = color5; 

但這沒有奏效。 我也試過在AppDelegate中這樣做:

[[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x067AB5)]; 

這個工作,但沒有設置導航欄我想要的顏色,只設置了導航欄,沒有狀態欄。我試圖找出我的UIColor的十六進制數字,但我無法弄清楚。我認爲問題是有小數,但它可以很好地設置我正在使用的按鈕。 非常感謝您的幫助。

回答

0

您可以使用此

if (IOS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) 
    { 
     [[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]]; 
    } else 
    { 
     [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; 
     [[UINavigationBar appearance] setBackgroundColor:[UIColor whiteColor]]; 
    }