UIImage change背景颜色

问题描述:

全部,UIImage change背景颜色

我们有从PhotoShop的图标设计,它是一个方形透明的图像,里面有一个蓝色的多边形。基于一些条件,我想改变多边形的颜色,但在完整的图像颜色。我们能做到这一点的代码(目标C)

enter image description here

我附上一个图像,其中只有背景“蓝”颜色需要根据我们给出的颜色被改变。我们如何achevie,

+0

入住这https://*.com/a/36475407/7250862 –

+0

是,在Objective C中有一条规定,以变更透明呈现图标的颜色。这里的过程https://*.com/questions/41545599/how-to-change-tintcolor-of-image-in-uibutton-with-imageedgeinsets/41547471#41547471 – Vishnuvardhan

你可以通过渲染图像UIImageRenderingModeAlwaysTemplate模式&之后,设置tintColor

imageView.image = [imageView.image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; 
[imageView setTintColor:[UIColor redColor]];