ios: change the colors of a UIImage

前端 未结 8 855
旧时难觅i
旧时难觅i 2020-11-27 12:50

I am working on an Iphone application.

I have png pictures that represents symbols. symbols are all black with a transparent background.

Is there a way I can

8条回答
  •  悲&欢浪女
    2020-11-27 13:00

    For iOS 13.0

    Obj-C:

    self.yourImageView.image = [self.yourImageView.image imageWithTintColor:[UIColor.redColor]];
    

    Swift:

    yourImageView.image = yourImageView.image.withTintColor(UIColor.red);
    

    If the image comes from the Asset Catalog, you can change the rendering in the Attribute Inspector

提交回复
热议问题