2013-12-11 54 views
0

我想,当它与这行代码选择改变UITabBarItem的色调颜色:UITabBar外观不工作

[[UITabBar appearance]setTintColor:[UIColor colorWithRed:89 green:216 blue:239 alpha:1]]; 

然而,当我选择的TabBar着色颜色变成白色。

任何人都知道为什么?

谢谢!

回答

2

在的UIColor:RGB,你需要devide 255

[UIColor colorWithRed:89/255.0f green:216/255.0f blue:239/255.0f alpha:1] 
1

将selectedImageTintColor属性设置为您的颜色。

+0

没有为我工作 –

1

值试试这个在您的应用程序委托的didFinishLaunching方法:

[[UITabBar appearance] setSelectedImageTintColor:[UIColor colorWithRed:89/255.0f green:216/255.0f blue:239/255.0f alpha:1]]; 

在iOS系统7使用:

[[UITabBar appearance] setTintColor:[UIColor colorWithRed:89/255.0f green:216/255.0f blue:239/255.0f alpha:1]]; 
2

请尝试以下操作:

[[UITabBar appearance] setTintColor:[[UIColor colorWithRed:89/255.0f green:216/255.0f blue:239/255.0f alpha:1]]; 

[[UITabBar appearance] setBarTintColor:[UIColor yellowColor]];//set rgb value if you want