1.在第三方SDImageCache.m中
- (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;
}
2.在SDImageCache.h中
- (float)checkTmpSize;
3.在方法中
- (void)buttonCache:(UIButton *)button
{
SDImageCache *sdimage = [[SDImageCache alloc] init];
float clean = [sdimage checkTmpSize];
NSLog(@"-----%f",clean);
[sdimage clearMemory];
[sdimage clearDisk];