我想进行无限旋转。但我看到一个旋转停顿。你能解释一下原因吗?
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
}()
)
答案 0 :(得分: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"];