进度的Block在子线程调用

[_pictureView sd_setImageWithURL:[NSURL URLWithString:item.image2] placeholderImage:nil options:SDWebImageRetryFailed progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {

//        NSLog(@"%ld %ld",receivedSize,expectedSize);

if (expectedSize == -1) return ;

CGFloat progress = 1.0 * receivedSize / expectedSize;

NSString *str = [NSString stringWithFormat:@"%.0f%%",progress * 100];

dispatch_sync(dispatch_get_main_queue(), ^{

_progressView.progressLabel.text = str;

_progressView.progress = progress;

});

} completed:nil];

进度的Block在子线程调用

上一篇:


下一篇:mac(linux) 上如何安装ant