当UIGestureRecognizerStateFailed时,CGaffinetransform重置

时间:2014-04-01 02:36:57

标签: ios xcode rotation uigesturerecognizer cgaffinetransform

我正在关注tutorial进行旋转控制。

目前我添加了image.transform = CGAffineTransformIdentity;,以便在手势成功结束时图像重置并旋转到原始状态。当UIGestureRecognizerStateFailed?

时,如何将图像重置为原始状态?

我已尝试将以下内容添加到- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event中,但它无效。

if (self.state == UIGestureRecognizerStateFailed) {
    OneFingerRotationGestureViewController *oneFingerRotationGestureViewController = 
      [[OneFingerRotationGestureViewController alloc] init];
    oneFingerRotationGestureViewController.image.transform = 
       CGAffineTransformIdentity;
}

1 个答案:

答案 0 :(得分:0)

UIGestureRecognizerStateFailed表示手势识别器从未识别出其手势,因此它什么也没做。换句话说,如果手势识别器失败,图像永远不会移动,因此无需做任何工作。