如何使用PINRemoteImage设置色调颜色?

问题描述 投票:0回答:1

我尝试使用PINRemoteImage下载图像后设置图像的色调颜色,但它不起作用。如何使用PINRemoteImage设置图像的色调?

let imageView = UIImageView()
imageView.pin_setImage(from: URL(string: "https://pinterest.com/kitten.jpg")!)
imageView.tintColor = UIColor.red
uiimageview uicolor
1个回答
0
投票

这工作,必须在下载图像后设置图像渲染模型,通过传入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
© www.soinside.com 2019 - 2024. All rights reserved.