检测动画的完成情况

Leg*_*las 5 iphone animation cocoa-touch core-animation objective-c

所以,

我用CABasicAnimation(如下所示)执行一个简单的动画.

CAAnimationGroup *theGroup = [CAAnimationGroup animation];
theGroup.fillMode = kCAFillModeForwards;
theGroup.removedOnCompletion = NO;
theGroup.delegate = self;
theGroup.timingFunction =[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];

theGroup.duration = inDuration;
theGroup.repeatCount = 0;
theGroup.animations = [NSArray arrayWithObjects:rotationZ, theAnimationX, theAnimationY, nil]; // you can add more

[inLayer addAnimation:theGroup forKey:@"animateLayer"];

NSLog (@"ABCD");
// This gets called before end of animation
Run Code Online (Sandbox Code Playgroud)

有什么方法-(BOOL) isAnimationCompleted;可以让我知道动画何时完成?

我希望在动画完全结束后立即运行一个方法.有任何想法吗 ?

Ila*_*ian 9

实施方法

- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
Run Code Online (Sandbox Code Playgroud)

你可以从这里看到文档.