How to apply a tintColor to a UIImage?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a UIImage that is a small symbol that is all black. The UIImage is getting set in a custom UIButton subclass I have. Is it possible to have the image to apply the tintColor to it, so instead of the black image it changes colors to whatever the tintColor is? I'm just trying to avoid creating new assets. // here I want defaultImageName (that is black) to use the tintColor (that is white) [self setImage:[UIImage imageNamed:defaultImageName] forState:UIControlStateNormal]; 回答1: If you are just supporting iOS 7 you can use tintColor and