答案 0 :(得分:0)
您可以尝试这样:
self.img.image = self.img.image?.withRenderingMode(.alwaysTemplate)
self.img.tintColor = UIColor.black
答案 1 :(得分:0)
let tableImage: UIImageView = {
let image = UIImageView()
image.image = image.withRenderingMode(.alwaysTemplate)
image.tintColor = .white
return image
}()
尝试一下,这将更改您的图像tintColor。我认为您不能在图像中设置多种颜色