2011-06-03 134 views
2

我想更改UITabBar的顏色。我在InterfaceBuilder的幫助下使用了UITabBar,但它沒有提供將tabbar顏色更改爲藍色的tabbar顏色的選項,任何人都可以告訴我做這項工作的最佳方式。如何更改UITabBar顏色?

非常感謝。

+1

您也可以從iDevRecipes這裏https://github.com/boctor/idev-recipes獲得現成的樣品。 – 2011-06-03 04:56:33

+0

http://stackoverflow.com/q/675433/777498和http://stackoverflow.com/q/571028/777498的重複問題 – Chanok 2011-06-03 04:03:10

回答

0

UITabBar沒有backgroundColortintColor財產。但是,您可以使用圖形來更改UITabBar的外觀。請查看iDevRecipes關於如何自定義UITabBars的教程。

0

試試這個:

UITabBarController *tabBarC = [[UITabBarController alloc] init]; 

if ([[[UIDevice currentDevice] systemVersion] compare:@"5.0" options:NSNumericSearch] != NSOrderedAscending) { 
    tabBarC.tabBar.selectedImageTintColor = [UIColor redColor]; 
} 

請記住,只有iOS5的+。