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完成塊? –