2011-04-01 112 views
10

誰能告訴我默認的iPhone導航欄藍色的RGB?我知道,你通常可以通過設置默認iPhone的UIColor導航欄

self.navigationBarTintColor = nil; 

然而,在這種情況下,這並不工作設置默認的顏色,所以我需要設定確切的藍色。

謝謝您的回答, Doonot

回答

10

您的權利:設置tintColor propertynil是設置默認的藍色的好辦法。

但爲了設置一個tintColor你必須做這樣的:

self.navigationController.navigationBar.tintColor = nil; 
+0

否:)我使用從TTThumsViewController Three20項目和afaik,默認顏色是黑色。所以如果我把它設置爲零,它會再次變黑(我測試過)。所以我想到的唯一解決方案就是設置顏色。Thx – doonot 2011-04-01 21:04:57

+0

對不起,如果我說錯了什麼,因爲我沒有與Three20工作,但TTThumsViewController似乎是一個UIViewController子類,你不能改變UINavigationBar tintColor想一個UIViewController,但UINavigationController或UINavigationBar子類? – klefevre 2011-04-01 21:12:01

4

我不知道這是否會幫助你或沒有。值得一試。

在Mac中打開數字色彩計應用程序。

現在在Interface Builder中打開一個視圖控制器

將在視圖控制器

移動導航欄鼠標的導航欄

現在你可以看到像素的的RGB值鼠標指向數字顏色表應用程序中。

使用您的UIColor RGB值

我知道它的奇怪。只是一個想法..只是一個想法..

3
  1. 創建單獨的項目,在界面生成器的默認着色顏色
  2. 編寫代碼來獲得着色顏色NSLog(@"tint color %@", navBar.tintColor); 你會看到結果的日誌添加UINavigationBartint color UIDeviceRGBColorSpace 0.121653 0.558395 0.837748 1
  3. 設置您希望使用此值的任何面板的色調顏色: [navBar setTintColor:[UIColor colorWithRed:0.121653f green:0.558395f blue:0.837748f alpha:1]];
1

[的UIColor colorWithRed:(247/255.0)綠色:(247/255.0)藍:(247/255.0) 阿爾法:1]

1
// Set Appdelegate.m file 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    // Override point for customization after application launch. 
    [self setCustomDesign]; 
} 
-(void)setCustomDesign 
{ 
    [[UINavigationBar appearance] setBarTintColor :UI_DEFAULT_NAV_COLOR] ; 
} 
//Constant.h 
#define UI_DEFAULT_NAV_COLOR [UIColor colorWithRed:5/255.0 green:123/255.0 blue:253/255.0 alpha:1.0f]