From d2b648e8ffd5433eb97ae64daeceeaa0813af915 Mon Sep 17 00:00:00 2001 From: Massimo Oliviero Date: Wed, 4 May 2016 17:23:05 +0200 Subject: [PATCH] Fixed completion logic in MKAnnotationView+WebCache --- SDWebImage/MKAnnotationView+WebCache.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SDWebImage/MKAnnotationView+WebCache.m b/SDWebImage/MKAnnotationView+WebCache.m index 5d4875c3..f7031657 100644 --- a/SDWebImage/MKAnnotationView+WebCache.m +++ b/SDWebImage/MKAnnotationView+WebCache.m @@ -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);