简体   繁体   中英

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.

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属性将动画配置为在完成动画之前重复一定次数,但是如果要重复已经完成的动画,则必须再次将其添加到图层。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM