I'm using SDWebImage to fetch images from web and display them. But some are GIFs, how to stop the GIF?
Asked
Active
Viewed 2,523 times
5
-
Do you mean stop the animation? Or removing the gif? I'd like to know the answer to both personally. – ScottyBlades Jan 09 '18 at 08:12
2 Answers
1
What you can do to stop the animation is to simply set your SDAnimatedImageView to for example
sdAnimatedImageView.image = SDAnimatedImage(named: "your.gif")?.animatedImageFrame(at: 0)
that way you will get one frame of your gif only and it will not be animated :)
its a hack but does the job

Jean Raymond Daher
- 306
- 3
- 11
0
Assuming you are using >= v4.0; from the docs:
Starting with the 4.0 version, we rely on FLAnimatedImage to take care of our animated images.
From FLAnimatedImage
's docs; there are 2 ways to control playback:
// An FLAnimatedImageView can take an FLAnimatedImage and plays it automatically when in view hierarchy and
stops when removed
.// The animation can also be controlled with the UIImageView methods -
start
/stop
/isAnimating
.