2013-09-16 134 views
4

看起來[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];在iOS7下不再工作。我可以設置背景圖像,但所選文字不再變爲紅色。我從我的應用程序委託中調用它。有沒有人試圖在iOS7下設置UITabBar的字體顏色和風格?在iOS7下設置自定義UITabBar字體顏色

回答

3

正是在iOS7 tintColor,請嘗試以下:

[[UITabBar appearance] setTintColor:[UIColor redColor]]; 

編輯

進行着色的非活動按鈕,把下面的代碼在VC的viewDidLoad

[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"item_seleted.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"item_unselected.png"]]; 
2

色彩不活躍的項目我用這個

UITabBarItem *item = [self.tabBar.items objectAtIndex:1]; 

// here you need to use the icon with the color you want, as it will be rendered as it is 
item.image = [[UIImage imageNamed:@"unselected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; 

// this icon is used for selected tab and it will get tinted as defined in self.tabBar.tintColor 
item.selectedImage = [UIImage imageNamed:@"selected.png"]; 
4

它的工作對我來說..

[[UITabBar appearance] setBarTintColor:[UIColor blackColor]]; 
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];