Handling download of image using SDWebImage while reusing UITableViewCell

前端 未结 3 845
眼角桃花
眼角桃花 2021-02-01 10:32

I have used third party library SDWebImage to download image for my UITableView cells, UIImageView is created within cell and fired request while configuring cell like this.

3条回答
  •  萌比男神i
    2021-02-01 11:18

    I met the same problem,I found UIImageView+WebCache cancel last download when a new download come.

    I not sure whether this is the intention of the author. So I write a new category of UIImageView base on SDWebImage.

    To view more: ImageDownloadGroup

    Easy to use:

    [cell.imageView mq_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
                       groupIdentifier:@"customGroupID"
                             completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    
                             }];
    

提交回复
热议问题