我尝试使用PINRemoteImage下载图像后设置图像的色调颜色,但它不起作用。如何使用PINRemoteImage设置图像的色调?
let imageView = UIImageView()
imageView.pin_setImage(from: URL(string: "https://pinterest.com/kitten.jpg")!)
imageView.tintColor = UIColor.red
这工作,必须在下载图像后设置图像渲染模型,通过传入PINRemoteImageManagerImageCompletion
回调在这个方法imageView.pin_setImage(from: URL?, completion: PINRemoteImageManagerImageCompletion?)
imageView.pin_setImage(from: "https://pinterest.com/kitten.jpg") { result in
result.image?.withRenderingMode(.alwaysTemplate)
imageView.image = result.image?.withRenderingMode(.alwaysTemplate)
}
imageView.tintColor = UIColor.red