之前遇到一个问题,大量高清图片显示的时候会出现手机内存疯长 导致app被系统kill,后来想到了一个解决办法 写在这里 记录一下。
#pragma mark --- 高分辨率的图片禁止图片解压缩操作
[[SDImageCache sharedImageCache] setShouldDecompressImages:NO];
[[SDWebImageDownloader sharedDownloader] setShouldDecompressImages:NO];
SDImageCache *canche = [SDImageCache sharedImageCache];
canche.shouldDecompressImages = NO;
SDWebImageDownloader *downloder = [SDWebImageDownloader sharedDownloader];
downloder.shouldDecompressImages = NO;
-(void)dealloc {
SDImageCache *canche = [SDImageCache sharedImageCache];
canche.shouldDecompressImages = YES;
SDWebImageDownloader *downloder = [SDWebImageDownloader sharedDownloader];
downloder.shouldDecompressImages = YES;
}
- 这样结合处理 就会解决内存的问题
网友评论