0
votes

How to nest multiple CA animation like UIView animateWithDuration does? For example, I need to animate 6 animations where each next animation goes after previous one. So, with UIView animateWithDuration, every next animation is called from complete block. Does CA allows to use blocks and etc.? If no then how to perform nested sequential animations?

2

2 Answers

1
votes

CAAnimation doesn't have a block-based API, but you could use its delegate method animationDidStop:finished: to chain multiple animations.

If you do this a lot, you may want to write your own block-based wrapper for this.

0
votes

Alternatively to omz's answer, you can set up NSTimer objects to start the successive parts of the animation.

[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(legOne:) userInfo:nil repeats:NO];
[NSTimer scheduledTimerWithTimeInterval:4.0 target:self selector:@selector(legTwo:) userInfo:nil repeats:NO];

Where legOne: is a method that does the first part of the animation, etc.