Yeongchan Jeon Yeongchan Jeon - 1 month ago 6
iOS Question

An UIBarButtonItem is colored with tint color. Can I get this displayed as it is?

The image below is the original one I want to display:

enter image description here

And I also put the following statement.

leftBtn.image = UIImage(named: "logo")


However, the image is displayes like the following one. I set the tint color as that dark grey.

enter image description here

Referencing this website disable tint on custom uibarbuttonitem images, I put this statement but it didn't make any change.

leftBtn.image?.imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)


Is there any other way to make the image shown as I want? Any advice would be appreciated!

Answer

You should try this

leftBtn.image = UIImage(named: "logo").imageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)