Authored by DreamPiggy

A little enhancement to avoid block capture the heap object

... ... @@ -60,7 +60,7 @@ typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished);
@end
// Convenience way to use transition. Remember to specify the duration
// Convenience way to create transition. Remember to specify the duration
// for UIKit, these transition just use the correspond `animationOptions`
// for AppKit, these transition use Core Animation in `animations`. So your view must be layer-backed. Set `wantsLayer = YES` before you apply it.
... ...
... ... @@ -195,16 +195,16 @@ static char TAG_ACTIVITY_SHOW;
#if SD_UIKIT || SD_MAC
else if ([view isKindOfClass:[UIImageView class]]) {
UIImageView *imageView = (UIImageView *)view;
finalSetImageBlock = ^(UIImage *tempImage, NSData *tempData) {
imageView.image = image;
finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData) {
imageView.image = setImage;
};
}
#endif
#if SD_UIKIT
else if ([view isKindOfClass:[UIButton class]]) {
UIButton *button = (UIButton *)view;
finalSetImageBlock = ^(UIImage *tempImage, NSData *tempData){
[button setImage:image forState:UIControlStateNormal];
finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData){
[button setImage:setImage forState:UIControlStateNormal];
};
}
#endif
... ...