Iphone 以降低的速度将UIView旋转360度以上
我有一个UIView,我想在给定的T时间内围绕它的中心点旋转N圈。旋转的速度应该逐渐降低。(像一个旋转的轮子)。我有下面的代码,它不能正常工作Iphone 以降低的速度将UIView旋转360度以上,iphone,ios,objective-c,core-animation,calayer,Iphone,Ios,Objective C,Core Animation,Calayer,我有一个UIView,我想在给定的T时间内围绕它的中心点旋转N圈。旋转的速度应该逐渐降低。(像一个旋转的轮子)。我有下面的代码,它不能正常工作 float T = 5; // 5 seconds float rotations = 10; //_containerView is the view to be rotate [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuratio
float T = 5; // 5 seconds
float rotations = 10;
//_containerView is the view to be rotate
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:T];
[UIView setAnimationRepeatCount:0];
[UIView setAnimationDelegate:self];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
CGAffineTransform t = CGAffineTransformRotate(_containerView.transform, (2*M_PI*rotations + 0));
_containerView.transform = t;
[UIView commitAnimations];
定义这些宏并使用
StartAnimation(<time>)
//your code
StopAnimation
StartAnimation()
//你的代码
停止动画
我认为这应该是一个评论。不是答案。无论如何,这不是我的答案PDid类似的东西,一次完成360,执行n次,每次增加时间,显示国际象棋种类移动使用静态int增加时间为什么要使用这样的宏?基于块的API提供了相同(和更多)的功能,但更干净、更容易理解?在社交应用程序中发现它很方便,每个事件都有动画“无法正常工作”…它有什么问题?
StartAnimation(<time>)
//your code
StopAnimation