zoukankan      html  css  js  c++  java
  • 利用SDWebImage 清理缓存

    新版的SDWebImage   已经计算好文件大小 只需要调用清理就够了

    //获取缓存文件大小

            float tmpSize = [[SDImageCache sharedImageCache] getSize];

            NSString *clearCacheName =  [NSString stringWithFormat:@"确定清理缓存(%.2fM)?",tmpSize/1024/1024]; 

     UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:clearCacheName delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];

            [alertView setTag:1001];

            [alertView show];

    - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {

        if (alertView.tag == 1001) {  

            if (buttonIndex == 1)   {

                [[SDImageCache sharedImageCache] clearDisk];

              }

        }

    }

    /*

    注意  是clearDisk  不是cleanDisk

    */ 

  • 相关阅读:
    linux知识笔记4
    linux知识笔记3
    linux知识笔记2
    linux常用命令笔记1
    计算机网络
    软件测试理论5
    软件测试理论4
    软件测试理论3
    Yarn 常用命令
    mac shell终端编辑命令行快捷键
  • 原文地址:https://www.cnblogs.com/Lovexiaohuzi/p/5909092.html
Copyright © 2011-2022 走看看