I have animated a UIScrollView this way:
let anim = CAKeyframeAnimation()
anim.keyPath = "bounds.origin.x"
anim.values = self.animValues
anim.keyTimes = self.animKeyTimes
anim.duration = self.animDuration
anim.additive = true
myScrollView.layer.addAnimation(anim, forKey: "move")
Then when the user taps a Cancel I tried this:
myScrollView.layer.removeAnimationForKey("move")
myScrollView.layer.removeAllAnimations()
Neither one works.
I also tried setting anim.duration = 0.0
. That had no effect.
I can't try doing anything with myScrollView.layer.presentationLayer()
because presentationLayer()
is nil
.
The animations do not need to be paused. They can be completely halted and discarded. They are never restarted.
These animations can be 30 seconds or more. Forcing the user to wait until it's finished is not good UX/UI.
Any help would be greatly appreciated.
Thanks,
David