Tint color for ios12 system image button doesn't work

1.1k Views Asked by At

I set the tintcolor of two system image buttons via storyboard, it works perfectly in all simulators and with ios13. but if I try with real Iphone 5s with ios 12.4 the two buttons are not displayed, the only things that properly works is button background color. I tried programmaticaly with plusBtn.imageView?.tintColor = .yellow or plusBtn.tintColor = .yellow. but it's the same,it works with ios13 but not with iphone 5s.

This is iphone 11 Pro simulator: enter image description here

and this is my real iphone5s device:

enter image description here

How can I set image tint color?

2

There are 2 best solutions below

1
Frankenstein On

You have to set the .withRenderingMode property to .alwaysTemplate for tintColor to work.

plusBtn.imageView?.image?.withRenderingMode(.alwaysTemplate)
0
Jirson Tavera On

You can try setting the image programmatically but you have to remove it from Attributes inspector in storyboard :) it solved the bug in iOS 12