之前遇到一個問題,大量高清圖片顯示的時候會出現手機記憶體瘋長 導致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;
}
複製程式碼
- 這樣結合處理 就會解決記憶體的問題