一般使用SDWebImage 进行图片的显示和缓存,一般缓存的内容比较多了就需要进行清空缓存
2016-05-12 16:54
501 查看
// 清理内存
[[SDImageCache sharedImageCache] clearMemory];
// 清理webview 缓存
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
[config.URLCache removeAllCachedResponses];
[[NSURLCache sharedURLCache] removeAllCachedResponses];
// 清理硬盘
[[SDImageCache sharedImageCache] clearDiskOnCompletion:^{
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
[self.tableView reloadData];
}];
[[SDImageCache sharedImageCache] clearMemory];
// 清理webview 缓存
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (NSHTTPCookie *cookie in [storage cookies]) {
[storage deleteCookie:cookie];
}
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
[config.URLCache removeAllCachedResponses];
[[NSURLCache sharedURLCache] removeAllCachedResponses];
// 清理硬盘
[[SDImageCache sharedImageCache] clearDiskOnCompletion:^{
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
[self.tableView reloadData];
}];
相关文章推荐
- 使用C#写入并保存为*.txt和读取数据
- android用户拒绝权限
- 深入浅出Mybatis系列(七)---mapper映射文件配置之insert、update、delete
- 关于自发电的一些想法
- ecshop 多表删除
- ListView显示用户输入记录
- 自定义控件
- Spring jdbcTemplate之决不回滚解决方案
- android MediaCodec的自己碰到的问题
- 保存全屏为image
- 比较大小(冒泡法)
- 深入浅出Mybatis系列(六)---objectFactory、plugins、mappers简介与配置
- 理解Fragment生命周期
- node.js的process进程和子进程
- 程序移植添加库问题
- 关于android 系统sdk自带的解压包zip的坑
- android studio gradle打包
- ssl1565 将功补过
- HierarchyView使用的注意事项
- Hibernate - DetachedCriteria 的完整用法