Juan Maceda
Juan Maceda

Reputation:

how to know when a coreanimation animation ends

I'm doing some animations with core animation, but I can't found a way to know with a notification or event when the animation block has finish, like in UIVIew animation block you have

setAnimationDidStopSelector:

how can I know this in core animation, thanks for any help

Upvotes: 3

Views: 1583

Answers (1)

Marco Mustapic
Marco Mustapic

Reputation: 3859

If you are using a CAAnimation instance, look at the animationDidStop:finished: for its delegate.

CAAnimation * animation = [CAAnimation animation];
animation.delegate = yourDelegate; // could be self, for example.
[yourLayer setAnimation:animation forKey:nil];

In the example above, yourDelegate should implement the animationDidStop:finished: method to be able to detect the animation end.

Upvotes: 7

Related Questions