diff --git a/SDWebImage/UIView+WebCache.m b/SDWebImage/UIView+WebCache.m index f6d5a4aa..c941a41f 100644 --- a/SDWebImage/UIView+WebCache.m +++ b/SDWebImage/UIView+WebCache.m @@ -97,13 +97,17 @@ static char TAG_ACTIVITY_SHOW; - (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock { if (setImageBlock) { setImageBlock(image, imageData); - } else if ([self isKindOfClass:[UIImageView class]]) { + return; + } +#if SD_UIKIT + if ([self isKindOfClass:[UIImageView class]]) { UIImageView *imageView = (UIImageView *)self; imageView.image = image; } else if ([self isKindOfClass:[UIButton class]]) { UIButton *button = (UIButton *)self; [button setImage:image forState:UIControlStateNormal]; } +#endif } - (void)sd_setNeedsLayout {