gpt4 book ai didi

ios - 使用 SDWebImage 下载大图像时应用程序崩溃

转载 作者:行者123 更新时间:2023-11-29 01:05:20 28 4
gpt4 key购买 nike

我正在使用 SDWebImage 从服务器异步下载图像。服务器上的一些图像的大小(1772x1476 像素)。我在 UICollectionView 上显示这些图像。几次运行后我收到内存警告和应用程序崩溃。有时第一次下载图像时会发生这种情况,有时当我上下滚动 Collection View 时会发生这种情况。这是我的代码-

我的 x 代码收到警告,如下图所示

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath];

[Mainimage sd_setImageWithURL:[NSURL URLWithString: Obj.imageYH] placeholderImage:[UIImage imageNamed:@""]];

return cell;
}

enter image description here

最佳答案

你可以使用:

[SDImageCache sharedImageCache].config.shouldDecompressImages = NO;[[SDWebImageDownloader sharedDownloader] setShouldDecompressImages:NO];

在 4.0-beta 版中

关于ios - 使用 SDWebImage 下载大图像时应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36468479/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com