2011-04-01 101 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]