How to clear all cached images loaded from SDWebImage?

前端 未结 4 2030
不知归路
不知归路 2020-12-09 16:07

I have all images loaded on my app via SDWebImage. The downloading and caching works great, but I wanted to make a button that can clear all cached images in the entire app.

4条回答
  •  一整个雨季
    2020-12-09 17:01

    Swift 4.2 , Xcode 10

    pod 'SDWebImage', '5.0.0-beta3'

    import SDWebImage
    
     @IBAction func ClearCacheButtonClick(_ sender: UIButton) {
         SDImageCache.shared.clearMemory()
         SDImageCache.shared.clearDisk()
     }
    

提交回复
热议问题