AnimatedImageView
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 UIImageView
and AnimatedImageView
out of box. So
it would be fairly easy to switch between them.
-
Enumeration that specifies repeat count of GIF
See moreDeclaration
Swift
public enum RepeatCount : Equatable
-
Whether automatically play the animation when the view become visible. Default is
true
.Declaration
Swift
public var autoPlayAnimatedImage: Bool
-
The count of the frames should be preloaded before shown.
Declaration
Swift
public var framePreloadCount: Int
-
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. Default is
true
.Declaration
Swift
public var needsPrescaling: Bool
-
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.
Declaration
Swift
public var backgroundDecode: Bool
-
The animation timer’s run loop mode. Default is
RunLoop.Mode.common
. Set this property toRunLoop.Mode.default
will make the animation pause during UIScrollView scrolling.Declaration
Swift
public var runLoopMode: RunLoop.Mode { get set }
-
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.
Default is
.infinite
, which means the animation will last forever.Declaration
Swift
public var repeatCount: AnimatedImageView.RepeatCount { get set }
-
Delegate of this
AnimatedImageView
object. SeeAnimatedImageViewDelegate
protocol for more.Declaration
Swift
public weak var delegate: AnimatedImageViewDelegate?
-
Undocumented
Declaration
Swift
override open var image: Image? { get set }
-
Undocumented
Declaration
Swift
override open var isAnimating: Bool { get }
-
Starts the animation.
Declaration
Swift
override open func startAnimating()
-
Stops the animation.
Declaration
Swift
override open func stopAnimating()
-
Undocumented
Declaration
Swift
override open func display(_ layer: CALayer)
-
Undocumented
Declaration
Swift
override open func didMoveToWindow()
-
Undocumented
Declaration
Swift
override open func didMoveToSuperview()