5

I'm using SDWebImage to fetch images from web and display them. But some are GIFs, how to stop the GIF?

nathan
  • 9,329
  • 4
  • 37
  • 51
JsW
  • 1,682
  • 3
  • 22
  • 34

2 Answers2

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

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.

Community
  • 1
  • 1
nathan
  • 9,329
  • 4
  • 37
  • 51