...
|
...
|
@@ -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;
|
|
|
}];
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|