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.
I have a "Clear Cache" button as a UIButton on one of my tab bar views. How can I make it so when this button is tapped, all the cached images are removed and need to be re-downloaded?
Using Swift.
Thank you!
How to clear "cache image and file" at your browser! To day, We updated some special funtion at our website!!! Please clear "cache image and file" at your browser before login to our website. Press the keys [Ctrl] , [Shift] and [Del]. Be sure you press all the keys at once. Or go to that link chrome://settings/clearBrowserData
In order to keep SDWebImage focused and limited to the core features, but also allow extensibility and custom behaviors, during the 5.0 refactoring we focused on modularizing the library. As such, we have moved/built new modules to SDWebImage org.
Support extendable coder plugins for new image formats like BPG, AVIF. And vector format like PDF, SVG. See all the list in Image coder plugin List In order to keep SDWebImage focused and limited to the core features, but also allow extensibility and custom behaviors, during the 5.0 refactoring we focused on modularizing the library.
Press the keys [Ctrl] , [Shift] and [del] on your Keyboard. A new window opens, where you can setup the options to delete the cache. Select the period "since installation", to empty the whole browser cache. Check the Option "Images and Files in Cache".
If you want to completely clear the cache do the following:
- (IBAction)clearCache:(id)sender {
[[SDImageCache sharedImageCache]clearMemory];
[[SDImageCache sharedImageCache]clearDisk];
}
SDImageCache.shared.clearMemory()
SDImageCache.shared.clearDisk()
@IBAction func clearCache(sender: UIButton) {
SDImageCache.shared().clearMemory()
SDImageCache.shared().clearDisk()
}
Try this:
@IBAction func actClearCache(sender:AnyObject) {
let objCache = SDImageCache.sharedImageCache()
objCache.clearMemory()
objCache.cleanDisk()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With