swift SDWebImage使用

1.SDWebImage下载图片

swift中,下载玩图片后,不会将图片缓存到沙盒,需要手动调用SDImageCache.shared.store保存到沙盒

 SDWebImageDownloader.shared.downloadImage(with: url, options: SDWebImageDownloaderOptions.highPriority, context: nil, progress: nil) { (image, data, _, _) in
      SDImageCache.shared.store(image, forKey: url.absoluteString, completion: {
                        
             print("图片保存成功")
             print(image as Any)
             print(data as Any)
       })   
 }
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容