这个属性很有意思自己可以看看,点击这里查看文章
下面是一个方法改变图片的颜色的方法
func drawImageColor(image: UIImage,color: UIColor) -> UIImage {
UIGraphicsBeginImageContextWithOptions(image.size, false, UIScreen.mainScreen().scale);
color.setFill();
let bounds = CGRectMake(0, 0, image.size.width, image.size.height);
UIRectFill(bounds);
image.drawInRect(bounds, blendMode: CGBlendMode.DestinationIn, alpha: 1);
let newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
接下来就自己看吧,自己琢磨了....
文章链接: https://onevcat.com/2013/04/using-blending-in-ios/