iOS 7 - Disable UITabBarItem tint color

2020-07-05 06:57发布

问题:

I have a UITabBar with five icons, most of them being flat with just one color. However, one of these buttons should not have a tint color, since it's the company's logo and the logo has various different colors. I know it's possible to to so with UINavigationBar and UIToolbar (which is what I'm using and it's a horrible workaround).

I did some heavy searching and tried many different solutions (I came up with with some crazy ones too), but none of them seem to work for me o iOS 7. Does anyone have an idea of how to achieve that?

Thanks a million!

回答1:

use ImageWithRenderingModeAlwaysOriginal.

UIImage *icon = [[UIImage imageNamed:@"yourImage"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];


回答2:

You can also create 'Image Asset' and set it there in the 'Attributes Inspector' tab.