How to permanently leave a CALayer rotated at its final location?
Posted
by
David
on Stack Overflow
See other posts from Stack Overflow
or by David
Published on 2011-01-10T02:25:54Z
Indexed on
2011/01/10
2:53 UTC
Read the original article
Hit count: 224
Hello,
I am trying to rotate a CALayer to a specific angle however, once the animation is done, the layer jumps back to its original position. How would I rotate the layer properly so that it stays at its final destination?
Here is the code that I am using
CABasicAnimation *rotationAnimation =[CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; //Rotate about z-axis
[rotationAnimation setFromValue:[NSNumber numberWithFloat:fromDegree]];
[rotationAnimation setToValue:[NSNumber numberWithFloat:toDegree]];
[rotationAnimation setDuration:0.2];
[rotationAnimation setRemovedOnCompletion:YES];
[rotationAnimation setFillMode:kCAFillModeForwards];
Any suggestions? Thank you.
© Stack Overflow or respective owner