我正在使用SDWebimage在我的桌面视图上加载图像,我正在关注this教程
现在我遇到了一个问题,如果我在图像加载之前向下滚动并回击,应用程序获得了crashes.How,我能解决这个问题吗?
如何取消SDWebImage下载。我已经看过了一些答案,但discussions.But没有一个对我有帮助,也不能使用它们
请帮帮我
我正在使用
[cell.UserImage setImageWithURL:[NSURL URLWithString:[SDWebArray objectAtIndex:indexPath.row]] placeholderImage:[UIImage imageNamed:@"Placeholder.png"]];发布于 2013-06-21 04:10:01
在您的计算单元中,如果要重用图像,则可以取消图像加载。在您的UITableViewCell子类中添加以下内容:
-(void)prepareForReuse {
[super prepareForReuse];
[self.imageView cancelCurrentImageLoad]; // UIImageView for whatever image you need to cancel the loading for
}也要确保使用#import "UIImageView+WebCache.h"。
虽然你的应用程序不应该崩溃,但我不能在没有看到一些代码的情况下帮助你,因为从你上面的描述中不可能准确地指出崩溃的原因。
发布于 2019-01-01 19:26:16
SWIFT 4.0
self.imageView.sd_cancelCurrentImageLoad()以防您正在使用SDWebImage活动指示器,并希望将其删除
self.imageView.sd_removeActivityIndicator()发布于 2016-10-05 14:47:35
- (void)cancelAll
{
for (SDWebImageDownloader *downloader in downloaders) {
[downloader cancel];
}
[cacheDelegates removeAllObjects];
[cacheURLs removeAllObjects];
[downloadInfo removeAllObjects];
[downloadDelegates removeAllObjects];
[downloaders removeAllObjects];
[downloaderForURL removeAllObjects];
}https://stackoverflow.com/questions/17222434
复制相似问题