Iphone 只能旋转UIImageView一次

Iphone 只能旋转UIImageView一次,iphone,ios,uiimageview,rotation,Iphone,Ios,Uiimageview,Rotation,我有一些代码,当用户触摸图像时,UIImageView会旋转180度。不幸的是,当用户再次触摸它时,什么也没有发生。我假设已经确定图像已经旋转了180度,这可能就是它不再移动的原因。我如何解决这个问题,谢谢 -(void) spinSun { [UIView animateWithDuration:2.0f animations:^{ imgSun.transform = CGAffineTransformMakeRotation(-3.142); } compl

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

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

    }];
}

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

imgSun.transform = CGAffineTransformRotate(imgSun.transform, -3.142)

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

imgSun.transform = CGAffineTransformRotate(imgSun.transform, -3.142)

imgSun.transform=CGAffineTransformRotate(imgSun.transform,-3.142);imgSun.transform=CGAffineTransformRotate(imgSun.transform,-3.142);