0

I want to make infinite rotation. But I see a rotating pause. Can you explain why?

    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
        }()
    )
Vasily Bodnarchuk
  • 24,482
  • 9
  • 132
  • 127

1 Answers1

0

I think you want circular rotation of UIView. you can achieved using below code.

 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"];
Jatin Patel - JP
  • 3,725
  • 2
  • 21
  • 43