SDWebImage cause crash

2017-04-10  本文已影响46人  lvzhehappy

我们经常在使用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"];

}

上一篇 下一篇

猜你喜欢

热点阅读