diff --git a/SDWebImage/MKAnnotationView+WebCache.m b/SDWebImage/MKAnnotationView+WebCache.m index dc97d9ba..be49ecbf 100644 --- a/SDWebImage/MKAnnotationView+WebCache.m +++ b/SDWebImage/MKAnnotationView+WebCache.m @@ -49,7 +49,7 @@ static char operationKey; id operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) { if (image) self.image = image; - if (completedBlock) completedBlock(image, error, fromCache); + if (completedBlock && finished) completedBlock(image, error, fromCache); }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } diff --git a/SDWebImage/UIButton+WebCache.m b/SDWebImage/UIButton+WebCache.m index 12dbc39e..1705d6d0 100644 --- a/SDWebImage/UIButton+WebCache.m +++ b/SDWebImage/UIButton+WebCache.m @@ -48,7 +48,7 @@ static char operationKey; id operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) { if (image) [self setImage:image forState:state]; - if (completedBlock) completedBlock(image, error, fromCache); + if (completedBlock && finished) completedBlock(image, error, fromCache); }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } @@ -90,7 +90,7 @@ static char operationKey; id operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) { if (image) [self setBackgroundImage:image forState:state]; - if (completedBlock) completedBlock(image, error, fromCache); + if (completedBlock && finished) completedBlock(image, error, fromCache); }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } diff --git a/SDWebImage/UIImageView+WebCache.m b/SDWebImage/UIImageView+WebCache.m index 2d200488..b16862cc 100644 --- a/SDWebImage/UIImageView+WebCache.m +++ b/SDWebImage/UIImageView+WebCache.m @@ -58,7 +58,7 @@ static char operationKey; self.image = image; [self setNeedsLayout]; } - if (completedBlock) + if (completedBlock && finished) { completedBlock(image, error, fromCache); }