1

我正在将箭头旋转 45 度。当动画结束时,箭头会返回其原始状态(0 度)。我需要箭头不会返回到原始状态,并且在动画结束时它将旋转 45 度。

CABasicAnimation *fullRotationShort = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotationShort.fromValue = [NSNumber numberWithFloat:0];
fullRotationShort.toValue = [NSNumber numberWithFloat:M_PI/28*4.7];
fullRotationShort.duration = 1.0f;
fullRotationShort.repeatCount = 1;
[imgViewArrowShort.layer addAnimation:fullRotationShort forKey:nil];
4

2 回答 2

6

假设您的箭头是UIImageView命名的arrow
你真的不需要这么复杂的 CAAnimations。

[UIView animateWithDuration:1.0 animations:^{ 
    arrow.transform = CGAffineTransformMakeRotation(0.25 * M_PI);
}];
于 2012-04-16T11:43:34.050 回答
1

设置属性:

fullRotationShort.fillMode = kCAFillModeForwards;
fullRotationShort.cumulative = YES;
   fullRotationShort.removedOnCompletion=NO;
于 2012-04-16T11:46:38.010 回答