使用tableView防止图片重复的方法

在使用TabelViewCell的时候,非常的方便,但是在网络环境差的时候,或者手机性能不好的情况下,快速滑动tableViewCell 的时候,使用SDWebImage 的时候,会出现图片重复的问题;解决这个问题方法很简单;

一:在创建cell的时候,cell的Indentifier使用不同的标记

 NSString *cellIdentifier = [NSString stringWithFormat:@"cell%ld%ld",(long)[indexPath section],(long)[indexPath row]];

二:在使用SDWebImage下载图片放置图片的时候,先把图片网址置为nil;

      self.productimage.image = nil;

      [self.productimage sd_setImageWithURL:[NSURL URLWithString:model.coverimg] placeholderImage:[UIImage imageNamed:@"img_scene"]];

后期回补充....未完待续

原文地址:https://www.cnblogs.com/jianglihui/p/5306184.html