Update the behavior for SDAnimatedImageView for animated image

This should still be compatible for custom image class like YYPlugin
This commit is contained in:
DreamPiggy 2024-05-06 15:25:57 +08:00
parent 7bf6a59524
commit 2c9deffdf2
1 changed files with 2 additions and 2 deletions

View File

@ -129,12 +129,12 @@
// We need call super method to keep function. This will impliedly call `setNeedsDisplay`. But we have no way to avoid this when using animated image. So we call `setNeedsDisplay` again at the end. // We need call super method to keep function. This will impliedly call `setNeedsDisplay`. But we have no way to avoid this when using animated image. So we call `setNeedsDisplay` again at the end.
super.image = image; super.image = image;
if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)] && [(id<SDAnimatedImage>)image animatedImageFrameCount] > 1) {
if (!self.player) { if (!self.player) {
id<SDAnimatedImageProvider> provider; id<SDAnimatedImageProvider> provider;
// Check progressive loading // Check progressive loading
if (self.isProgressive) { if (self.isProgressive) {
provider = [self progressiveAnimatedCoderForImage:image]; provider = [(id<SDAnimatedImage>)image animatedCoder];
} else { } else {
provider = (id<SDAnimatedImage>)image; provider = (id<SDAnimatedImage>)image;
} }