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 sequenti开发者_开发知识库al animations?
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.
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.
精彩评论