How to change the color of an UIImage

后端 未结 7 472

I want not to change the backgroundColor of an UIImage,
but rather to change the color of the whole image.

Because I have got standard forms which I can move fr

7条回答
  •  北海茫月
    2020-12-02 08:15

    Swift + Interface builder (storyboard)

    If you added the UIImageView in the interface builder:

    myIcon.image = myIcon.image!.withRenderingMode(UIImageRenderingMode.alwaysTemplate)
    myIcon.tintColor = UIColor.red // your color
    

    where myIcon is an outlet from your storyboard, ex: @IBOutlet weak var myIcon: UIImageView!

提交回复
热议问题