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

    */ 

  • 相关阅读:
    穷举和迭代
    for循环练习题
    case when then else end 用法
    如何将数据库账号(用户)解锁
    比赛安排
    How to spend you day ?
    异常-问题型
    重载和重写的区别
    new关键字的理解-问题型
    源辰项目-1
  • 原文地址:https://www.cnblogs.com/Lovexiaohuzi/p/5909092.html
Copyright © 2011-2022 走看看