相关疑难解决方法(0)

如何在iOS中处理1到3个手指轻扫手势

我使用以下代码处理我的代码中的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)

谢谢.

iphone objective-c ios swipe-gesture

8
推荐指数
2
解决办法
1万
查看次数

多点触控绘图时如何忽略手掌?

几个多点触控绘图应用程序已经实现了一些功能,可以防止用户在绘图时将手掌放在屏幕上时产生干扰.

他们如何从手掌中滤除触摸事件,但允许从绘图手指或手写笔输入正确的信息?

iphone multi-touch

0
推荐指数
1
解决办法
270
查看次数

标签 统计

iphone ×2

ios ×1

multi-touch ×1

objective-c ×1

swipe-gesture ×1