[英]Replaying a Core Animation animation?
I was wondering, what if I want to replay an animation I have already added to the layer? 我想知道,如果要重播已经添加到图层中的动画怎么办? Do I need to add the animation to the layer each and every time I want it to play, or there's a way to replay an animation I have already added?
我是否需要在每次播放动画时都将其添加到图层中,还是可以重播已经添加的动画?
Thanks, iLyrical. 谢谢,iLyrical。
Once animation gets finished then to repeat animation u will have to add new animation like this: 一旦动画完成,然后重复动画,您将必须添加新的动画,如下所示:
[yourView.layer removeAllAnimations];
[yourView.layer addAnimation:yourAnimation forKey:@"Key here"];
您可以使用repeatCount
属性将动画配置为在完成动画之前重复一定次数,但是如果要重复已经完成的动画,则必须再次将其添加到图层。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.