您的位置:首页 > 其它

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

2014-05-27 18:52 183 查看
转载自: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动画!!!射射大神
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐