Custom tab bar icon colors

2019-01-17 05:05发布

Im currently using Xcode 5 to develop a list oriented app. I have a custom tint for the tab bar, custom images for the tab icons, custom tint for the tab bar's icon images when its selected, but i cannot find how to customize the icon images' tint for when its not selected. Right now its just the default gray which you can barely see in contrast to my green tab bar. I want to make the tab bar icons' images and names white.

Does anybody know how to set the tab bar icons' image tint in Xcode 5?

标签: ios xcode xcode5
7条回答
三岁会撩人
2楼-- · 2019-01-17 05:52

Because setFinishedSelectedImage:withFinishedUnselectedImage is deprecated, I used an altered version of Ram S's answer by replacing:

[item0 setFinishedSelectedImage:[UIImage imageNamed:@"iconBlue.png"]  withFinishedUnselectedImage:[UIImage imageNamed:@"iconGray.png"] ];

with:

[item0 setImage:[[UIImage imageNamed:@"iconGray.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[item0 setSelectedImage:[[UIImage imageNamed:@"iconBlue.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];

See UITabBarItem setFinishedSelectedImage: deprecated in iOS7 for more information.

查看更多
登录 后发表回答