FS.O6 FS.O6 - 1 month ago 13
Swift Question

UITabBarItem tintColor according to selectedImage

I have a

UITabBar
with 5 tabs.

I set an "unselectedImage" to tabBarItem's
image
property and "selectedImage" to tabBarItem's
selectedImage
property.

the "selectedImage" is an image with a gradient, but it present it in the color of the
tabBar.tintColor
.

So how can I cancel the
tintColor
and make the original image to be presented (without coloring it with the
tintColor
)?

Thanks!

Answer

When you set the image, define the rederingMode:

let image = yourUIImage.renderingMode = alwaysOriginal
Comments