Skip to content

Commit

Permalink
Merge pull request SDWebImage#1310 from xzenon/patch
Browse files Browse the repository at this point in the history
Added support for SDWebImageAvoidAutoSetImage option to UIButton and highlighted UIImageView categories
  • Loading branch information
mythodeia committed Sep 23, 2015
2 parents 14842f6 + 05ce156 commit b185621
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
14 changes: 12 additions & 2 deletions SDWebImage/UIButton+WebCache.m
Expand Up @@ -74,7 +74,12 @@ - (void)sd_setImageWithURL:(NSURL *)url forState:(UIControlState)state placehold
dispatch_main_sync_safe(^{
__strong UIButton *sself = wself;
if (!sself) return;
if (image) {
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock)
{
completedBlock(image, error, cacheType, url);
return;
}
else if (image) {
[sself setImage:image forState:state];
}
if (completedBlock && finished) {
Expand Down Expand Up @@ -117,7 +122,12 @@ - (void)sd_setBackgroundImageWithURL:(NSURL *)url forState:(UIControlState)state
dispatch_main_sync_safe(^{
__strong UIButton *sself = wself;
if (!sself) return;
if (image) {
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock)
{
completedBlock(image, error, cacheType, url);
return;
}
else if (image) {
[sself setBackgroundImage:image forState:state];
}
if (completedBlock && finished) {
Expand Down
7 changes: 6 additions & 1 deletion SDWebImage/UIImageView+HighlightedWebCache.m
Expand Up @@ -39,7 +39,12 @@ - (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)op
dispatch_main_sync_safe (^
{
if (!wself) return;
if (image) {
if (image && (options & SDWebImageAvoidAutoSetImage) && completedBlock)
{
completedBlock(image, error, cacheType, url);
return;
}
else if (image) {
wself.highlightedImage = image;
[wself setNeedsLayout];
}
Expand Down

0 comments on commit b185621

Please sign in to comment.