美文网首页
SDWebImage + 缓存清理

SDWebImage + 缓存清理

作者: 吃货_X | 来源:发表于2016-09-11 17:57 被阅读39次

    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;

    }

    然后调用

    相关文章

      网友评论

          本文标题:SDWebImage + 缓存清理

          本文链接:https://www.haomeiwen.com/subject/kliuettx.html