解决动画效果只能旋转 180的问题

转载自:http://code4app.com/requirement/53182a60933bf0b93e8b6293


如何用动画不断旋转一个uiview????
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.9];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationRepeatCount:100];
[self.inputView.fransform setUserInteractionEnabled:YES];
self.inputView.fransform.transform = CGAffineTransformMakeRotation(M_PI*2);
[UIView commitAnimations];
完全没效果,如果CGAffineTransformMakeRotation=M_PI得话又只能旋转180度,为什么呢?



  • CABasicAnimation* rotationAnimation; 
  • rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; 
  • rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ]; 
  • [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 
  • rotationAnimation.duration = 2; 
  • rotationAnimation.RepeatCount = 1000;//你可以设置到最大的整数值 
  • rotationAnimation.cumulative = NO; 
  • rotationAnimation.removedOnCompletion = NO; 
  • rotationAnimation.fillMode = kCAFillModeForwards; 
  • [rotateView.layer addAnimation:rotationAnimation forKey:@"Rotation"]; 
  • @小刚WHM : 哦,原来用layer动画!!!射射大神

你可能感兴趣的:(解决动画效果只能旋转 180的问题)