open class AnimatedImageView: UIImageView
Represents a subclass of
UIImageView for displaying animated image.
Different from showing animated image in a normal
UIImageView (which load all frames at one time),
AnimatedImageView only tries to load several frames (defined by
framePreloadCount) to reduce memory usage.
It provides a tradeoff between memory usage and CPU time. If you have a memory issue when using a normal image
view to load GIF data, you could give this class a try.
Kingfisher supports setting GIF animated data to either
AnimatedImageView out of box. So
it would be fairly easy to switch between them.
Enumeration that specifies repeat count of GIF
An animator which used to drive the data behind
public var autoPlayAnimatedImage = true
Whether automatically play the animation when the view become visible. Default is
public var framePreloadCount = 10
The count of the frames should be preloaded before shown.
public var needsPrescaling = true
Specifies whether the GIF frames should be pre-scaled to the image view's size or not.
If the downloaded image is larger than the image view's size, it will help to reduce some memory use.
public var backgroundDecode = true
Decode the GIF frames in background thread before using. It will decode frames data and do a off-screen rendering to extract pixel information in background. This can reduce the main thread CPU usage.
public var runLoopMode = KFRunLoopModeCommon
The animation timer's run loop mode. Default is
Set this property to
RunLoop.Mode.default will make the animation pause during UIScrollView scrolling.
public var repeatCount = RepeatCount.infinite
The repeat count. The animated image will keep animate until it the loop count reaches this value. Setting this value to another one will reset current animation.
.infinite, which means the animation will last forever.
public weak var delegate: AnimatedImageViewDelegate?
Delegate of this
AnimatedImageView object. See
AnimatedImageViewDelegate protocol for more.
public private(set) var animator: Animator?
Animator instance that holds the frames of a specific image in memory.
override open var image: KFCrossPlatformImage?
open override var isHighlighted: Bool
override open var isAnimating: Bool
override open func startAnimating()
Starts the animation.
override open func stopAnimating()
Stops the animation.
override open func display(_ layer: CALayer)
override open func didMoveToWindow()
override open func didMoveToSuperview()