2017-04-18 67 views
1

我试图从URL下载图像,模糊它,缓存它,然后将其显示在表格视图单元格中。如何将模糊应用于图像,然后使用Kingfisher将其缓存?

我这样做:

let resource = ImageResource(downloadURL: url, cacheKey: recipe.uid) 
backgroundImageView.kf.setImage(with: resource) 
backgroundImageView.image = backgroundImageView.image?.kf.blurred(withRadius: CGFloat(7.6)) 

但这意味着我将其设置为这是不想要我想要的图像视图后图像模糊。 有什么建议吗?谢谢!

回答

1

找到了解决方案:

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) 
相关问题