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 に答える