我正在尝试从 下载图像URL,对其进行模糊处理,将其缓存,然后将其显示在表格视图单元格中。
我这样做了:
let resource = ImageResource(downloadURL: url, cacheKey: recipe.uid)
backgroundImageView.kf.setImage(with: resource)
backgroundImageView.image = backgroundImageView.image?.kf.blurred(withRadius: CGFloat(7.6))
Run Code Online (Sandbox Code Playgroud)
但这意味着在将图像设置为我不想要的图像视图后,我会模糊图像。有什么建议?谢谢!
找到了解决办法:
let resource = ImageResource(downloadURL: url, cacheKey: recipe.uid)
let processor = BlurImageProcessor(blurRadius: 4)
backgroundImageView.kf.setImage(with: resource, placeholder: nil, options: [.processor(processor)], progressBlock: nil, completionHandler: nil)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1021 次 |
| 最近记录: |