你的位置:首页 > 软件开发 > 操作系统 > iOS 用 SDWebImage 清理图片缓存

iOS 用 SDWebImage 清理图片缓存

发布时间:2016-04-13 23:00:04
具体效果如下 1.找到 SDWebImage找到SDImageCache类添加如下方法- (float)checkTmpSize{ float totalSize = 0; NSDirectoryEnumerator *fileEnumerator = [[NS ...

iOS 用 SDWebImage 清理图片缓存

具体效果如下

iOS 用 SDWebImage 清理图片缓存

 

 

1.找到 SDWebImage找到SDImageCache类

添加如下方法

- (float)checkTmpSize{  float totalSize = 0;  NSDirectoryEnumerator *fileEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:_diskCachePath];  for (NSString *fileName in fileEnumerator)  {    NSString *filePath = [_diskCachePath stringByAppendingPathComponent:fileName];        NSDictionary *attrs = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil];        unsigned long long length = [attrs fileSize];        totalSize += length / 1024.0 / 1024.0;  }  //  NSLog(@"tmp size is %.2f",totalSize);    return totalSize;}

原标题:iOS 用 SDWebImage 清理图片缓存

关键词:IOS

IOS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。