0
我从来没有遇到过这个问题。我的animationDidStop方法在动画实际完成之前被调用。 animationDidStart被首先调用,但之后立即调用animationDidStop。我尝试使用动画完成块来处理这个问题,但它仍然立即完成动画。有人跑过这个吗?我真的可以使用一些帮助。谢谢。animationDidStop方法立即调用
- 詹姆斯
CODE:
-(void) runAnimation {
//Create an animation that rotates the tile
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
[animation setDuration:6];
[animation setFromValue:[NSNumber numberWithFloat:0]];
[animation setToValue:[NSNumber numberWithFloat:0.5*M_PI]];
[animation setDelegate:self];
animation.fillMode = kCAFillModeForwards;
animation.removedOnCompletion = NO;
[[self.view viewWithTag:100].layer addAnimation:animation forKey:@"solutionRotate"];
}
-(void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
{
if (theAnimation == [[self.view viewWithTag:100].layer animationForKey:@"solutionRotate"]){
//test
NSLog (@"test");
}
}
您的代码示例中是否存在错误?添加“animateStuff”而不是“动画” –
您是否尝试过使用CATransaction完成块? –