SDWebImage does not load remote images until scroll

前端 未结 4 2066
清歌不尽
清歌不尽 2020-12-13 07:39

I am using SDWebImage library to load remote images into a table view which uses a custom cell class i have created. I simply use

[cell.imageView setImageWit         


        
4条回答
  •  清歌不尽
    2020-12-13 08:09

    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.

    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) {
    
                             }];
    

    To view more: ImageDownloadGroup

    Advanced usage:

    //  create customGroup
    MQImageDownloadGroup *customGroup = [[MQImageDownloadGroup alloc] initWithGroupIdentifier:@"tableViewCellGroup"];
    customGroup.maxConcurrentDownloads = 99;
    
    //  add to MQImageDownloadGroupManage
    [[MQImageDownloadGroupManage shareInstance] addGroup:customGroup];
    
    //  use download group
    [cell.imageView mq_setImageWithURL:@"https://xxx"
                       groupIdentifier:@"tableViewCellGroup"
                             completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    
                             }];
    

提交回复
热议问题