Need to set defaultImage, not image if we're a network image node. (#3041)

This commit is contained in:
Garrett Moon
2017-02-17 13:16:57 -08:00
committed by GitHub
parent b616248c20
commit 4e779eeed8

View File

@@ -20,6 +20,7 @@
#import <AsyncDisplayKit/ASImageNode+AnimatedImagePrivate.h>
#import <AsyncDisplayKit/ASImageProtocols.h>
#import <AsyncDisplayKit/ASInternalHelpers.h>
#import <AsyncDisplayKit/ASNetworkImageNode.h>
#import <AsyncDisplayKit/ASWeakProxy.h>
NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes;
@@ -91,6 +92,17 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes;
}
if (setCoverImage) {
[self setCoverImage:coverImage];
}
}
- (void)setCoverImage:(UIImage *)coverImage
{
//If we're a network image node, we want to set the default image so
//that it will correctly be restored if it exits the range.
if ([self isKindOfClass:[ASNetworkImageNode class]]) {
[(ASNetworkImageNode *)self setDefaultImage:coverImage];
} else {
self.image = coverImage;
}
}
@@ -172,7 +184,7 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes;
[super didEnterVisibleState];
if (self.animatedImage.coverImageReady) {
self.image = self.animatedImage.coverImage;
[self setCoverImage:self.animatedImage.coverImage];
}
[self startAnimating];
}