之前遇到一个问题,大量高清图片显示的时候会出现手机内存疯长 导致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; } 复制代码
- 这样结合处理 就会解决内存的问题