如何在iOS8中更改TabBar Icon选择的颜色?

时间:2015-05-06 19:10:38

标签: ios objective-c cocoa-touch uitabbar

彻底搜索SO正在为此问题制定空白。

之前的所有答案都建议使用已被弃用的setSelectedImageTintColor

如何在选择时更改UITabBar按钮图标&项目的颜色?

1 个答案:

答案 0 :(得分:1)

NSArray *itemArray = self.tabBar.items;

UITabBarItem *item0 =  [itemArray firstObject];

item0.image = [[UIImage imageNamed:@"tap_home_button"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

item0.selectedImage = [[UIImage imageNamed:@"tap_home_button_hightlighed"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];