static BOOL SDImageCacheOldShouldDecompressImages = YES;
static BOOL SDImagedownloderOldShouldDecompressImages = YES;
- (void)viewDidLoad {
[super viewDidLoad];
//設(shè)置圖片緩存方式 防止圖片過大崩潰的情況
SDImageCache *canche = [SDImageCache sharedImageCache];
SDImageCacheOldShouldDecompressImages = canche.config.shouldDecompressImages;
canche.config.shouldDecompressImages = NO;
SDWebImageDownloader *downloder = [SDWebImageDownloader sharedDownloader];
SDImagedownloderOldShouldDecompressImages = downloder.shouldDecompressImages;
downloder.shouldDecompressImages = NO;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
[[SDWebImageManager sharedManager].imageCache clearMemory];
[[SDWebImageManager sharedManager].imageCache clearDiskOnCompletion:nil];
}
- (void)dealloc {
[[SDImageCache sharedImageCache] clearMemory];
SDImageCache *canche = [SDImageCache sharedImageCache];
canche.config.shouldDecompressImages = SDImageCacheOldShouldDecompressImages;
SDWebImageDownloader *downloder = [SDWebImageDownloader sharedDownloader];
downloder.shouldDecompressImages = SDImagedownloderOldShouldDecompressImages;
}
SDWebImage加載大圖內(nèi)存暴漲
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 網(wǎng)上的思路基本就是把下載的圖片進(jìn)行壓縮,但是我這邊遇到點(diǎn)問題,一個是網(wǎng)上的基本是老版本的SDWebImage,我用...
- 加載超清大圖是會引起內(nèi)存爆表的問題,最近一直困擾著我。SDWebImage在加載大圖時做的不是很好,加載大圖內(nèi)存爆...
- 原文鏈接:http://m.itdecent.cn/p/eb859cb99974 加載超清大圖是會引起內(nèi)存爆...
- 轉(zhuǎn)載于SDWebImage加載多個網(wǎng)絡(luò)高清圖片內(nèi)存崩潰 Crash[https://blog.csdn.net/b...
- SDWebImage,地球人都在用。帶著問題去考慮下SDWebImage問題1:一個tableView列表,使用S...