Skip to content

Instantly share code, notes, and snippets.

@casspangell
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save casspangell/185ce843496f72a71e3f to your computer and use it in GitHub Desktop.

Select an option

Save casspangell/185ce843496f72a71e3f to your computer and use it in GitHub Desktop.
Rotate UIView 360 Degrees
- (void)animate {
CABasicAnimation *rotate = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
rotate.byValue = @(M_PI*2); // Change to - angle for counter clockwise rotation
rotate.duration = 5.0;
rotate.repeatCount = HUGE_VALF; //rotates infinitely. Can be finite value.
[self.view.layer addAnimation:rotate forKey:@"myRotationAnimation"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment