只能旋转一次UIImageView

gar*_*hdn 1 iphone rotation uiimageview ios

我有一些代码,UIImageView当用户触摸图像时会导致旋转180度.不幸的是,当用户再次触摸它时,没有任何反应.我假设确定图像已经旋转了180度,这可能就是为什么它不再移动了.我如何解决这个问题,谢谢.

-(void) spinSun
{
    [UIView animateWithDuration:2.0f animations:^{
        imgSun.transform = CGAffineTransformMakeRotation(-3.142);
    } completion:^(BOOL finished) {

    }];
}
Run Code Online (Sandbox Code Playgroud)

Mar*_*ich 5

您必须创建一个新的转换矩阵:

imgSun.transform = CGAffineTransformRotate(imgSun.transform, -3.142)
Run Code Online (Sandbox Code Playgroud)