zoukankan      html  css  js  c++  java
  • UITapGestureRecognizer

    Configuring the Gesture

    @property(nonatomic) NSUInteger numberOfTapsRequired
    @property(nonatomic) NSUInteger numberOfTouchesRequired
    

    例子

        // 单击的 Recognizer
        UITapGestureRecognizer* singleRecognizer;
        singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:selfaction:@selector(SingleTap:)];
        //点击的次数
        singleRecognizer.numberOfTapsRequired = 1; // 单击
        [self.view addGestureRecognizer:singleRecognizer];
        
        // 双击的 Recognizer
        UITapGestureRecognizer* doubleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:selfaction:@selector(DoubleTap:)];
        doubleRecognizer.numberOfTapsRequired = 2; // 双击
        //关键语句,给self.view添加一个手势监测;
        [self.view addGestureRecognizer:doubleRecognizer];
        
        // 关键在这一行,双击手势确定监测失败才会触发单击手势的相应操作
        [singleRecognizer requireGestureRecognizerToFail:doubleRecognizer];
        [singleRecognizer release];
        [doubleRecognizer release];
    

     



  • 相关阅读:
    Web API入门二(实例)
    Web API 入门一
    模板编程
    Unity3D中的AI架构模型
    Linux系列
    LCS记录
    hadoop使用问题
    AOP之Castle DynamicProxy 动态代理
    python 之readability与BeautifulSoup
    django rest_framework--入门教程3
  • 原文地址:https://www.cnblogs.com/zhongriqianqian/p/3986664.html
Copyright © 2011-2022 走看看