2013-12-11 53 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