Is there a way to pause a CABasicAnimation?

Posted by mclaughlinj on Stack Overflow See other posts from Stack Overflow or by mclaughlinj
Published on 2010-02-21T18:20:04Z Indexed on 2010/06/09 7:52 UTC
Read the original article Hit count: 358

I have a basic spinning animation of the iPhone. Is there any way that I can "pause" the animation so that the position of the view will be maintained? I guess one way of doing this would be to cause the animation to "complete" instead of calling "remove" on it, how would I do that?

CABasicAnimation* rotationAnimation;
rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2];
rotationAnimation.duration = 100;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = HUGE_VALF;
rotationAnimation.removedOnCompletion = NO;
rotationAnimation.fillMode = kCAFillModeForwards;
[myView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];

© Stack Overflow or respective owner

Related posts about iphone-sdk

Related posts about core-animation