Fixed an issue where playing an animated photo with YYWebImage could not stay on the last frame.

This commit is contained in:
吴尚昆 2021-11-10 13:34:28 +08:00 committed by osborn
parent 44135ebf26
commit 4e2b4d051b

View File

@ -37,11 +37,12 @@ @interface DoricImageView : YYAnimatedImageView
@implementation DoricImageView @implementation DoricImageView
- (void)displayLayer:(CALayer *)layer { - (void)displayLayer:(CALayer *)layer {
if (@available(iOS 14.0, *)) { if (@available(iOS 14.0, *)) {
if (self.isAnimating) { if ([self.image isKindOfClass:YYImage.class]
&& ((YYImage *) self.image).animatedImageData) {
[super displayLayer:layer]; [super displayLayer:layer];
} else { } else {
layer.contents = (__bridge id) self.image.CGImage; layer.contents = (__bridge id) self.image.CGImage;
}; }
} else { } else {
[super displayLayer:layer]; [super displayLayer:layer];
} }