Authored by DreamPiggy

Set UIButton's placeholer-image even if the url is nil

@@ -71,11 +71,10 @@ static inline NSString * backgroundImageURLKeyForState(UIControlState state) { @@ -71,11 +71,10 @@ static inline NSString * backgroundImageURLKeyForState(UIControlState state) {
71 completed:(nullable SDExternalCompletionBlock)completedBlock { 71 completed:(nullable SDExternalCompletionBlock)completedBlock {
72 if (!url) { 72 if (!url) {
73 [self.imageURLStorage removeObjectForKey:imageURLKeyForState(state)]; 73 [self.imageURLStorage removeObjectForKey:imageURLKeyForState(state)];
74 - return; 74 + } else {
  75 + self.imageURLStorage[imageURLKeyForState(state)] = url;
75 } 76 }
76 77
77 - self.imageURLStorage[imageURLKeyForState(state)] = url;  
78 -  
79 __weak typeof(self)weakSelf = self; 78 __weak typeof(self)weakSelf = self;
80 [self sd_internalSetImageWithURL:url 79 [self sd_internalSetImageWithURL:url
81 placeholderImage:placeholder 80 placeholderImage:placeholder
@@ -131,11 +130,10 @@ static inline NSString * backgroundImageURLKeyForState(UIControlState state) { @@ -131,11 +130,10 @@ static inline NSString * backgroundImageURLKeyForState(UIControlState state) {
131 completed:(nullable SDExternalCompletionBlock)completedBlock { 130 completed:(nullable SDExternalCompletionBlock)completedBlock {
132 if (!url) { 131 if (!url) {
133 [self.imageURLStorage removeObjectForKey:backgroundImageURLKeyForState(state)]; 132 [self.imageURLStorage removeObjectForKey:backgroundImageURLKeyForState(state)];
134 - return; 133 + } else {
  134 + self.imageURLStorage[backgroundImageURLKeyForState(state)] = url;
135 } 135 }
136 136
137 - self.imageURLStorage[backgroundImageURLKeyForState(state)] = url;  
138 -  
139 __weak typeof(self)weakSelf = self; 137 __weak typeof(self)weakSelf = self;
140 [self sd_internalSetImageWithURL:url 138 [self sd_internalSetImageWithURL:url
141 placeholderImage:placeholder 139 placeholderImage:placeholder