Fixed completion logic in MKAnnotationView+WebCache

This commit is contained in:
Massimo Oliviero 2016-05-04 17:23:05 +02:00
parent 0df58e4995
commit d2b648e8ff
1 changed files with 11 additions and 2 deletions

View File

@ -51,8 +51,17 @@ static char imageURLKey;
dispatch_main_sync_safe(^{
__strong MKAnnotationView *sself = wself;
if (!sself) return;
if (image) {
sself.image = image;
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock) {
completedBlock(image, error, cacheType, url);
return;
} else if (image) {
wself.image = image;
[wself setNeedsLayout];
} else {
if ((options & SDWebImageDelayPlaceholder)) {
wself.image = placeholder;
[wself setNeedsLayout];
}
}
if (completedBlock && finished) {
completedBlock(image, error, cacheType, url);