2011-10-19 30 views
1

我可以用下面的命令改變顏色的TabBar圖標的iOS 5

[[UITabBar appearance] setSelectionIndicatorImage: 
[UIImage imageNamed:@"tab_select_indicator"]]; 
[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]]; 

再整的UITabBar但我怎麼可以設置imageTintColor當未選擇的選項卡。默認顏色是灰色的,我想將其更改爲藍色。

感謝

回答

3

從Apple文檔UITabBar類參考:

如果你想還可以自定義未選擇的圖像外觀,你必須送setFinishedSelectedImage:withFinishedUnselectedImage:個人標籤欄項目。

3

在AppDlegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]]; 
return YES; 
}