From 717461459fe51ad7eda1f804e50d3c417c92cbfd Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Mon, 26 Dec 2022 19:05:39 +0800 Subject: [PATCH] Hack the first frame to ensure it always displayed in first screen refresh --- SDWebImage/Core/SDAnimatedImagePlayer.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SDWebImage/Core/SDAnimatedImagePlayer.m b/SDWebImage/Core/SDAnimatedImagePlayer.m index 196db572..efb6f9b8 100644 --- a/SDWebImage/Core/SDAnimatedImagePlayer.m +++ b/SDWebImage/Core/SDAnimatedImagePlayer.m @@ -152,6 +152,8 @@ UIImage *posterFrame = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation]; #endif if (posterFrame) { + // HACK: The first frame should not check duration and immediately display + self.needsDisplayWhenImageBecomesAvailable = YES; SD_LOCK(self->_lock); self.frameBuffer[@(self.currentFrameIndex)] = posterFrame; SD_UNLOCK(self->_lock);