Lots of people are talking about keeping an CABasicAnimation object around after it has been used.
So by setting
removedOnCompletion = NO
the animation object keeps attached to the layer when the animation is complete. How would I re-launch this animation again without creating a new CABasicAnimation?
What's the point of keeping this object around? The only benefit I know is that we can set removedOnCompletion = NO and set kCAFillModeForwards so that Core Animation does not revert the visual representation back to the model values in the CALayer.
But how to re-use the animation, like everyone is talking about?
Try this:
Add the animation with a key using [layer addAnimation:myAnimation forKey:@"myKey"]
To get a reference to it later, call [layer animationForKey:@"myKey"]
Read this note from Apple which explains how to pause and resume (restart) animations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With