I have a problem with the setting UIViewAnimationOptionAutoReverse
.
Here is my code.
CALayer *aniLayer = act.viewToChange.layer;
[UIView animate
There is a repeatCount
property on CAMediaTiming
. I think you have to create an explicit CAAnimation
object, and configure it properly. The repeatCount for grow and ungrow would be 2, but you can test this.
Something a long the lines of this. You would need two CAAnimation objects though, one for the frame and one for the rotation.
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation"];
theAnimation.duration=3.0;
theAnimation.repeatCount=1;
theAnimation.autoreverses=YES;
theAnimation.fromValue=[NSNumber numberWithFloat:0.0];
theAnimation.toValue=[NSNumber numberWithFloat:degreesToRadians(34)];
[theLayer addAnimation:theAnimation forKey:@"animateRotation"];
AFAIK there is no way to avoid programming two animation objects.