2

I was able to detect a rotation gesture, but I only need to detect the one from right to left.

I would really appreciate any help.

Thanks!

4

1 回答 1

4

我假设您正在使用 UIRotationGestureRecognizer 来检测旋转。你应该有这样的东西:

UIRotationGestureRecognizer *gestureRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(gestureRecognizerAction:)];
[self.view addGestureRecognizer:gestureRecognizer];

和:

- (void)gestureRecognizerAction:(UIRotationGestureRecognizer *)gestureRecognizer
{
  if (gestureRecognizer.rotation > 0) {
     //rotation in one side - lets say from left to right
  } else {
     //rotation in other side - lets say from right to left
  }
}

这样,您将只能检测到从右到左的旋转。

于 2013-07-18T21:07:51.477 回答