【问题标题】:How to apply blur to image and then cache it with Kingfisher?如何对图像应用模糊,然后用 Kingfisher 缓存它?
【发布时间】:2017-04-19 06:15:31
【问题描述】:

我正在尝试从URL 下载图像,对其进行模糊处理、缓存,然后将其显示在表格视图单元格中。

我这样做了:

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

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

【问题讨论】:

    标签: swift kingfisher


    【解决方案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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-18
      • 1970-01-01
      • 2023-03-20
      • 2017-09-18
      • 1970-01-01
      • 2013-10-03
      • 1970-01-01
      • 2014-12-16
      相关资源
      最近更新 更多