Authored by DreamPiggy
Committed by GitHub

Merge pull request #2043 from dreampiggy/set_uibutton_placeholder_if_url_is_nil

Set UIButton's placeholer-image even if the url is nil
... ... @@ -71,11 +71,10 @@ static inline NSString * backgroundImageURLKeyForState(UIControlState state) {
completed:(nullable SDExternalCompletionBlock)completedBlock {
if (!url) {
[self.imageURLStorage removeObjectForKey:imageURLKeyForState(state)];
return;
} else {
self.imageURLStorage[imageURLKeyForState(state)] = url;
}
self.imageURLStorage[imageURLKeyForState(state)] = url;
__weak typeof(self)weakSelf = self;
[self sd_internalSetImageWithURL:url
placeholderImage:placeholder
... ... @@ -131,11 +130,10 @@ static inline NSString * backgroundImageURLKeyForState(UIControlState state) {
completed:(nullable SDExternalCompletionBlock)completedBlock {
if (!url) {
[self.imageURLStorage removeObjectForKey:backgroundImageURLKeyForState(state)];
return;
} else {
self.imageURLStorage[backgroundImageURLKeyForState(state)] = url;
}
self.imageURLStorage[backgroundImageURLKeyForState(state)] = url;
__weak typeof(self)weakSelf = self;
[self sd_internalSetImageWithURL:url
placeholderImage:placeholder
... ...