我正在尝试旋转UIImageView
360度,并在线查看了几个教程.我可以让他们都没有工作,没有UIView
停止,或跳到一个新的位置.
我尝试过的最新事情是:
[UIView animateWithDuration:1.0
delay:0.0
options:0
animations:^{
imageToMove.transform = CGAffineTransformMakeRotation(M_PI);
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
Run Code Online (Sandbox Code Playgroud)
但是如果我使用2*pi,它根本不会移动(因为它是相同的位置).如果我尝试做pi(180度),它可以工作,但如果我再次调用该方法,它会向后旋转.
编辑:
[UIView animateWithDuration:1.0
delay:0.0
options:0
animations:^{
[UIView setAnimationRepeatCount:HUGE_VALF];
[UIView setAnimationBeginsFromCurrentState:YES];
imageToMove.transform = CGAffineTransformMakeRotation(M_PI);
}
completion:^(BOOL finished){
NSLog(@"Done!");
}];
Run Code Online (Sandbox Code Playgroud)
也不起作用.它会转到180
度数,暂停一瞬间,然后在重新0
开始之前重新设置为度数.