我们经常在使用tableView加载网络图片,会发现随着条目数越来越多,内存占有率会变得越来越高,然后就会发生崩溃,所以在SDWebImage时一定要记得随时清理cache.解决方法如下:
- (void)sdWebImageConfig
{
[[SDImageCache sharedImageCache] setShouldDecompressImages:NO];
[[SDWebImageDownloader sharedDownloader] setShouldDecompressImages:NO];
}
- (void)didReceiveMemoryWarning
{
[[SDImageCache sharedImageCache] clearMemory];
[[SDImageCache sharedImageCache] cleanDisk];
[[SDImageCache sharedImageCache] clearDisk];
[[SDImageCache sharedImageCache] setValue:nil forKey:@"memCache"];
}