旋转动画

时间:2012-04-16 11:38:07

标签: iphone objective-c animation rotation

我将箭头旋转了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];

2 个答案:

答案 0 :(得分:6)

假设您的箭头是名为UIImageView的{​​{1}} 你真的不需要这么复杂的CAAnimations。

arrow

答案 1 :(得分:1)

设置属性:

fullRotationShort.fillMode = kCAFillModeForwards;
fullRotationShort.cumulative = YES;
   fullRotationShort.removedOnCompletion=NO;