Merge pull request #2043 from dreampiggy/set_uibutton_placeholder_if_url_is_nil

Set UIButton's placeholer-image even if the url is nil
This commit is contained in:
DreamPiggy 2017-09-29 12:21:38 -05:00 committed by GitHub
commit 05fea33dac
1 changed files with 4 additions and 6 deletions

View File

@ -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