大佬教程收集整理的这篇文章主要介绍了ios – 如果尚未缓存,如何使用SDWebImageManager下载图像?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
SDWebImageManager.shared().imageDownloader?.downloadImage(with:URL(String: imgurL),options: SDWebImageDownloaderOptionS.UseNSURLCache,progress: nil,completed: { (image,error,cacheType,url) in if image != nil { let beginImage = CIImage(image: image!) let blackNwhiteImg = beginImage?.applyingFilter("CIColorControls",withInputParameters: [kCIInputSaturationKey:0.0]) let newImage = UIImage(ciImage: blackNwhiteImg!) cell.button.setImage(newImage,for: .normal) } })
SDWebImageManager.shared().loadImage(with: URL?,options: SDWebImageOptions,progress: { (Int,Int,URL?) in code },completed: { (UIImage?,Data?,Error?,SDImageCacheType,Bool,URL?) in code })
为了便于参考,我将在此屏幕截图中显示XCode在输入功能时显示的注释:
此外,SDWebImageManager文件中包含的注释:
/** * Downloads the image at the given URL if not present in cache or return the cached version otherwise. * * @param url The URL to the image * @param options A mask to specify options to use for this request * @param progressBlock A block called while image is downloading * @note the progress block is executed on a BACkground queue * @param completedBlock A block called when operation has been completed. * * This parameter is required. * * This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter. * In case of error the image parameter is nil and the third parameter may contain an NSError. * * The forth parameter is an `SDImageCacheType` enum inDicaTing if the image was retrieved from the local cache * or from the memory cache or from the network. * * The fith parameter is set to NO when the SDWebImageProgressiveDownload option is used and the image is * downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded,the * block is called a last time with the full image and the last parameter set to YEs. * * The last parameter is the original image URL * * @return Returns an NSObject conforming to SDWebImageOperation. Should be an instance of SDWebImageDownloaderOperation
以上是大佬教程为你收集整理的ios – 如果尚未缓存,如何使用SDWebImageManager下载图像?全部内容,希望文章能够帮你解决ios – 如果尚未缓存,如何使用SDWebImageManager下载图像?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。