Stefano Quarta
Stefano Quarta

Reputation: 67

Tint color for ios12 system image button doesn't work

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?

Upvotes: 3

Views: 1280

Answers (2)

Jirson Tavera
Jirson Tavera

Reputation: 1333

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

Upvotes: 2

Frankenstein
Frankenstein

Reputation: 16341

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

plusBtn.imageView?.image?.withRenderingMode(.alwaysTemplate)

Upvotes: 2

Related Questions