0

I have an image icon on storyboard and have been trouble changing it's tint Color. Is there something I'm missing?

@IBOutlet weak var tickMarkImage: UIImageView! {
    didSet {
        tickMarkImage.image?.withRenderingMode(.alwaysTemplate)
        tickMarkImage.tintColor = .systemRed
        tickerMarkImage.backgroundColor = .systemGreen
    }
}
Kenny Ho
  • 409
  • 3
  • 16

1 Answers1

0

Set the image rendering mode to .alwaysOriginal. It worked for me.

This is how I set images (this specific case if for buttons but it's pretty much the same):

 let imageToSet = UIImage(named: "name")
 button(imageToSet, for: state)
 button = .white
  • 1
    Thanks for sharing, but it's still not working. I guess the easiest way is to just add the image with tint already added. – Kenny Ho Nov 03 '20 at 15:57