我使用以下代码来处理我的代码中的单指滑动:
然而,当我添加了上述代码后,由于所需触摸次数现在为2,因此无法再检测到单指滑动。我该怎么做才能让我的代码适用于1、2或3个手指的滑动呢?我尝试使用以下代码,但这并不是我想要的结果。
谢谢。
UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleViewsSwipe:)];
[swipe setDirection:UISwipeGestureRecognizerDirectionLeft];
[swipe setDelaysTouchesBegan:YES];
[[self view] addGestureRecognizer:swipe];
我知道我可以添加以下行来使其处理两个手指的滑动:
[swipe setNumberOfTouchesRequired:2];
然而,当我添加了上述代码后,由于所需触摸次数现在为2,因此无法再检测到单指滑动。我该怎么做才能让我的代码适用于1、2或3个手指的滑动呢?我尝试使用以下代码,但这并不是我想要的结果。
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleViewsSwipe:)];
[panRecognizer setMinimumNumberOfTouches:1];
[panRecognizer setMaximumNumberOfTouches:3];
[panRecognizer setDelaysTouchesBegan:YES];
[[self view] addGestureRecognizer:panRecognizer];
[panRecognizer release];
谢谢。