github地址 : https://github.com/rs/SDWebImage
demo写的清楚缓存按钮方法 ( 使用了 alertController )
float cache = [[SDImageCache sharedImageCache] getSize] / 1024.0 / 1024.0;
NSString *clearCacheName = cache >= 1 ? [NSString stringWithFormat:@"清理缓存(%.2fM)",cache] : [NSString stringWithFormat:@"清理缓存(%.2fK)",cache * 1024];
UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"提示" message:clearCacheName preferredStyle:(UIAlertControllerStyleAlert)];
UIAlertAction *cleanAction = [UIAlertAction actionWithTitle:@"清理" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[[SDImageCache sharedImageCache] clearDisk];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"缓存清理完成" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alertView show];
}];
[alertC addAction:cancelAction];
[alertC addAction:cleanAction];
[self presentViewController:alertC animated:YES completion:nil];
若有不解 请看:
最新版 SDWebImage:http://www.cocoachina.com/ios/20141212/10622.html
清理缓存方面:http://www.open-open.com/lib/view/open1425625126743.html
http://blog.csdn.net/heartofthesea/article/details/14127749