Do not call completed block on categories for intermediate progressive images

This commit is contained in:
Olivier Poitrey 2012-11-06 18:24:57 +01:00
parent e5b0d22e64
commit b29bb2e2e1
3 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ static char operationKey;
id<SDWebImageOperation> 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);
}

View File

@ -48,7 +48,7 @@ static char operationKey;
id<SDWebImageOperation> 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<SDWebImageOperation> 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);
}

View File

@ -58,7 +58,7 @@ static char operationKey;
self.image = image;
[self setNeedsLayout];
}
if (completedBlock)
if (completedBlock && finished)
{
completedBlock(image, error, fromCache);
}