diff --git a/Examples/SDWebImage Demo/DetailViewController.m b/Examples/SDWebImage Demo/DetailViewController.m index 4d27bfb..d7acf6a 100644 --- a/Examples/SDWebImage Demo/DetailViewController.m +++ b/Examples/SDWebImage Demo/DetailViewController.m @@ -31,24 +31,23 @@ - (void)configureView { - if (self.imageURL) - { + if (self.imageURL) { __block UIActivityIndicatorView *activityIndicator; __weak UIImageView *weakImageView = self.imageView; - [self.imageView setImageWithURL:self.imageURL placeholderImage:nil options:SDWebImageProgressiveDownload progress:^(NSInteger receivedSize, NSInteger expectedSize) - { - if (!activityIndicator) - { - [weakImageView addSubview:activityIndicator = [UIActivityIndicatorView.alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]]; - activityIndicator.center = weakImageView.center; - [activityIndicator startAnimating]; - } - } - completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) - { - [activityIndicator removeFromSuperview]; - activityIndicator = nil; - }]; + [self.imageView sd_setImageWithURL:self.imageURL + placeholderImage:nil + options:SDWebImageProgressiveDownload + progress:^(NSInteger receivedSize, NSInteger expectedSize) { + if (!activityIndicator) { + [weakImageView addSubview:activityIndicator = [UIActivityIndicatorView.alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]]; + activityIndicator.center = weakImageView.center; + [activityIndicator startAnimating]; + } + } + completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { + [activityIndicator removeFromSuperview]; + activityIndicator = nil; + }]; } } diff --git a/Examples/SDWebImage Demo/MasterViewController.m b/Examples/SDWebImage Demo/MasterViewController.m index 8300c59..c1d3d62 100644 --- a/Examples/SDWebImage Demo/MasterViewController.m +++ b/Examples/SDWebImage Demo/MasterViewController.m @@ -374,8 +374,8 @@ cell.textLabel.text = [NSString stringWithFormat:@"Image #%ld", (long)indexPath.row]; cell.imageView.contentMode = UIViewContentModeScaleAspectFill; - [cell.imageView setImageWithURL:[NSURL URLWithString:[_objects objectAtIndex:indexPath.row]] - placeholderImage:[UIImage imageNamed:@"placeholder"] options:indexPath.row == 0 ? SDWebImageRefreshCached : 0]; + [cell.imageView sd_setImageWithURL:[NSURL URLWithString:[_objects objectAtIndex:indexPath.row]] + placeholderImage:[UIImage imageNamed:@"placeholder"] options:indexPath.row == 0 ? SDWebImageRefreshCached : 0]; return cell; }