SDWebImage添加菊花

//添加菊花加载
      __block UIActivityIndicatorView *activityIndicator;
     [cell.imageView sd_setImageWithURL:[NSURL URLWithString:imgUrlStr] placeholderImage:nil options:SDWebImageRetryFailed progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {
         
         if (!activityIndicator)
         {
             dispatch_async(dispatch_get_main_queue(), ^{
                 
                 [cell.imageView addSubview:activityIndicator = [UIActivityIndicatorView.alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]];
                 activityIndicator.center = cell.imageView.center;
                 [activityIndicator startAnimating];
             });
            
         }
         
     } completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
         dispatch_async(dispatch_get_main_queue(), ^{
             
             [activityIndicator removeFromSuperview];
             activityIndicator = nil;
         });
        

         
     }];

你可能感兴趣的:(SDWebImage添加菊花)