0

我想做无限旋转。但我看到一个旋转的停顿。你能解释一下为什么吗?

    UIView.animateWithDuration(0.5, delay: 0, options: UIViewAnimationOptions.Repeat | UIViewAnimationOptions.CurveLinear, animations:
        {
            self.myview.transform = CGAffineTransformRotate(self.myview.transform, CGFloat(M_PI_2))
        }, completion: { nil
        }()
    )
4

1 回答 1

0

我想你想要UIView. 您可以使用以下代码实现。

 CABasicAnimation* rotationAnimation;
    rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0  * 1 * 3 ];
    rotationAnimation.duration = 3;
    rotationAnimation.cumulative = YES;
    rotationAnimation.repeatCount = 5;

    [btnPush.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
于 2015-04-21T08:14:57.507 回答