我使用以下代码处理我的代码中的1个手指滑动:
UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleViewsSwipe:)];
[swipe setDirection:UISwipeGestureRecognizerDirectionLeft];
[swipe setDelaysTouchesBegan:YES];
[[self view] addGestureRecognizer:swipe];
Run Code Online (Sandbox Code Playgroud)
我知道我可以添加以下行以使其处理2个手指滑动:
[swipe setNumberOfTouchesRequired:2];
Run Code Online (Sandbox Code Playgroud)
但是,当我添加上面的代码时,由于现在所需的触摸次数为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];
Run Code Online (Sandbox Code Playgroud)
谢谢.
几个多点触控绘图应用程序已经实现了一些功能,可以防止用户在绘图时将手掌放在屏幕上时产生干扰.
他们如何从手掌中滤除触摸事件,但允许从绘图手指或手写笔输入正确的信息?