SDWebImage取消下载 [英] SDWebImage Cancel download

查看:1080
本文介绍了SDWebImage取消下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SDWebimage在我的tablkeview上加载图片
我正在关注这个教程

I am using SDWebimage to load images on my tablkeview I am following this tutorial

现在我遇到了一个问题,如果我向下滚动并在图像加载之前回来,应用程序崩溃了。我怎么能解决这个问题?

Now I stuck on a problem,If I scroll down and hit back before images get loaded the app got crashes.How can I solve this ?

如何取消SDWebImage下载。
我已经完成了一些答案和讨论。但他们都没有帮助我,也无法使用它们

How to cancel the SDWebImage download. I have gone through some answers and discussions.But none of them helped me and could not use them

请帮帮我

我正在使用

  [cell.UserImage setImageWithURL:[NSURL URLWithString:[SDWebArray objectAtIndex:indexPath.row]]  placeholderImage:[UIImage imageNamed:@"Placeholder.png"]];


推荐答案

在您的单元格中,您可以取消图像加载它会被重新使用。在 UITableViewCell 子类中添加以下内容:

In your cell, you can cancel the image load if it's going to get re-used. In your UITableViewCell subclass add the following:

-(void)prepareForReuse {
    [super prepareForReuse];
    [self.imageView cancelCurrentImageLoad]; // UIImageView for whatever image you need to cancel the loading for
}

请务必 #importUIImageView + WebCache.h

虽然你的应用程序不应该崩溃,但是如果没有看到某些代码,我无法帮助您,因为无法从上述说明中查明崩溃的原因。

Though your app shouldn't be crashing, but I cannot help you without seeing some code, since it's not possible to pinpoint the cause of the crash from your description above.

这篇关于SDWebImage取消下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆