Show activity indicator in SDWebImage

前端 未结 18 1388
独厮守ぢ
独厮守ぢ 2021-01-30 09:20

I\'m using SDWebView image and i want to show an Activity Indicator as placeholder, while fetching the image from remote.

I tried Malek\'s answer here How to show an act

18条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 09:43

    [cell.dreamImageView setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",dream.thumbnail]] placeholderImage:[UIImage imageNamed:@"dream_bg_2.png"] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {
    
        CGFloat domandeFloat = [[NSNumber numberWithInt: receivedSize] floatValue];
        CGFloat corretteFloat = [[NSNumber numberWithInt: expectedSize] floatValue];
    
    
        float currentProgress = domandeFloat/corretteFloat;
    
         NSLog(@"progress %f",currentProgress);
        cell.progressView.progress = currentProgress;
    
        //[self.dreamsTableView reloadData];
    
    
    } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
    
        cell.progressView.hidden = YES;
    }];
    

提交回复
热议问题