ios – 如何在Swift 3.0中使用SDWebImage完成块?

前端之家收集整理的这篇文章主要介绍了ios – 如何在Swift 3.0中使用SDWebImage完成块?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我用 SDWebImage来下载图片.如果成功下载图像,我想进一步操作.
cell.appIcon.sd_setImage(with: url,placeholderImage: UIImage.init(named: "App-Default"),completed: {(image: UIImage!,error: NSError!,cacheType: SDImageCacheType,imageURL: URL!) -> Void in
      // Perform operation. 
})

但是我收到了错误

Cannot convert value of type ‘(UIImage!,NSError!,SDImageCacheType,URL!) -> Void’ to expected argument type ‘SDExternalCompletionBlock?’

解决方法

终于解决了.
cell.appIcon.sd_setImage(with: url!,placeholderImage: UIImage(named: "App-Default"),options: SDWebImageOptions(rawValue: 0),completed: { (image,error,cacheType,imageURL) in
 // Perform operation.
})
原文链接:https://www.f2er.com/iOS/333874.html

猜你在找的iOS相关文章