Tint UIImageView永久

时间:2014-09-19 17:33:55

标签: ios swift uiimageview tintcolor

我想为UIImageView着色,但截至目前,当我着色并使用控件(例如按下按钮)时,色调消失了。有什么想法吗?

class func tintImageView(imageView : UIImageView, withColor color:UIColor) {

    var coloredImage = imageView.image?.imageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate)
    imageView.image = coloredImage
    imageView.tintColor = color
}

1 个答案:

答案 0 :(得分:0)

按钮controlState可能已更改,每个controlState都有自己的imageView。

相关问题