I have the following CABasicAnimation
run in my viewDidLoad
for a view controller inside a UINavigationController
:
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
animation.duration = 1;
animation.additive = NO;
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;
animation.fromValue = [NSNumber numberWithFloat:0];
animation.toValue = [NSNumber numberWithFloat:-1*(((-windBearing+180) * M_PI) / 180)];
[compass.layer addAnimation:animation forKey:@"90rotation"];
When I use the edge swipe gesture to slowly navigate back, the animation resets to the initial state, which is quite jarring. I have my fillMode
set and removedOnCompletion
set to NO
, what am I missing?