Authored by Konstantinos K

Merge pull request #1547 from maxoly/master

Fixed completion logic in MKAnnotationView+WebCache
@@ -51,8 +51,17 @@ static char imageURLKey; @@ -51,8 +51,17 @@ static char imageURLKey;
51 dispatch_main_sync_safe(^{ 51 dispatch_main_sync_safe(^{
52 __strong MKAnnotationView *sself = wself; 52 __strong MKAnnotationView *sself = wself;
53 if (!sself) return; 53 if (!sself) return;
54 - if (image) {  
55 - sself.image = image; 54 + if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock) {
  55 + completedBlock(image, error, cacheType, url);
  56 + return;
  57 + } else if (image) {
  58 + wself.image = image;
  59 + [wself setNeedsLayout];
  60 + } else {
  61 + if ((options & SDWebImageDelayPlaceholder)) {
  62 + wself.image = placeholder;
  63 + [wself setNeedsLayout];
  64 + }
56 } 65 }
57 if (completedBlock && finished) { 66 if (completedBlock && finished) {
58 completedBlock(image, error, cacheType, url); 67 completedBlock(image, error, cacheType, url);