Pause the display link upon initialization

- Closes #48
This commit is contained in:
Reda Lemeden 2016-04-07 14:04:22 +02:00
parent 91ba7459cb
commit 75220e571c
1 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,11 @@ public class AnimatableImageView: UIImageView {
/// An `Animator` instance that holds the frames of a specific image in memory.
var animator: Animator?
/// A display link that keeps calling the `updateFrame` method on every screen refresh.
lazy var displayLink: CADisplayLink = CADisplayLink(target: self, selector: #selector(updateFrame))
lazy var displayLink: CADisplayLink = {
let display = CADisplayLink(target: self, selector: #selector(updateFrame))
display.paused = true
return display
}()
/// The size of the frame cache.
public var framePreloadCount = 50