【问题标题】:Multitouch basics (3 or more fingers)多点触控基础知识(3 个或更多手指)
【发布时间】:2011-09-17 20:31:50
【问题描述】:

我注意到在 iOS 中缺乏与真正的多点触控相关的问题。我不是在谈论一根手指的触摸事件,我是在谈论 3 个或更多手指的触摸事件。是否有任何关于大量触摸输入的手势处理的资源或文档文章?如果没有,你们中的任何人过去使用过哪些基本方法有效?

(P.S. 我的最终目标是 NSLOG 用 3 根手指向下滑动)。

【问题讨论】:

    标签: objective-c ios ipad multi-touch


    【解决方案1】:

    使用手势识别器 - 它们为您处理触摸处理,并且大多数允许您指定要识别的手势的最少手指数。在你的情况下,例如:

    // -viewDidLoad
    UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swiped:)];
    swipeRecognizer.direction = UISwipeGestureRecognizerDirectionDown;
    swipeRecognizer.numberOfTouchesRequired = 3;
    [self.view addGestureRecognizer:swipeRecognizer];
    [swipeRecognizer release];
    

    - (void)swiped:(UISwipeGestureRecognizer *)recognizer
    {
        if(recognizer.state == UIGestureRecognizerStateRecognized)
        {
            // got a three-finger swipe
        }
    }
    

    【讨论】:

    • 非常感谢!我不敢相信我错过了touchesrequired的财产。 +1 并为你打勾!
    猜你喜欢
    • 1970-01-01
    • 2020-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-02
    • 2015-01-19
    • 2011-08-22
    • 2012-07-12
    相关资源
    最近更新 更多