Itamar
Itamar

Reputation: 1338

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.

Upvotes: 1

Views: 365

Answers (2)

Paresh Navadiya
Paresh Navadiya

Reputation: 38249

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"];

Upvotes: 1

David Rönnqvist
David Rönnqvist

Reputation: 56625

You can configure the animation to repeat a certain number of times before it finishes using the repeatCount property but if you want to repeat an animation that has already finished you have to add it to the layer again.

Upvotes: 0

Related Questions