zoukankan      html  css  js  c++  java
  • 手势

    一、手势种类

    • UITapGestureRecognizer  点击
    • UIPinchGestureRecognizer 二指往内或往外拨动
    • UIRotationGestureRecognizer 旋转
    • UISwipeGestureRecognizer 滑动,快速移动
    • UIPanGestureRecognizer 拖移,慢速移动
    • UILongPressGestureRecognizer 长按

    二、事件

       1、单击
       UITapGestureRecognizersingleRecognizer;
        singleRecognizer [[UITapGestureRecognizer allocinitWithTarget:selfaction:@selector(handleSingleTapFrom)];
        singleTapRecognizer.numberOfTapsRequired 1// 单击
        [self.view addGestureRecognizer:singleRecognizer];
      2、双击
        // 双击的 Recognizer
        UITapGestureRecognizerdouble;
        doubleRecognizer [[UITapGestureRecognizer allocinitWithTarget:selfaction:@selector(handleDoubleTapFrom)];
        doubleTapRecognizer.numberOfTapsRequired 2// 双击
        [self.view addGestureRecognizer:doubleRecognizer];
     

        // 关键在这一行,如果双击确定偵測失败才會触发单击

        [singleRecognizer requireGestureRecognizerToFail:doubleRecognizer];
     
    3、二指往内或往外拨动
    UIPinchGestureRecognizer *twoFingerPinch =[[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(twoFingerPinch:)];
    [self.view addGestureRecognizer:twoFingerPinch]; - (void)twoFingerPinch:(UIPinchGestureRecognizer *)recognizer { NSLog(@"Pinch scale: %f", recognizer.scale);
    }
     4、旋转
       UIRotationGestureRecognizer *rotationRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotate:)];
        [rotationRecognizer setDelegate:self];
        [self.view addGestureRecognizer:rotationRecognizer];
     
  • 相关阅读:
    链家大数据多维分析引擎实践
    html 读取变量
    django 分配字典给前台模板
    django将数组传递给前台模板
    fetachone和fetchall
    django捕获url中的值
    django 控制页面跳转
    MySQL的前缀索引及Oracle的类似实现
    django url捕获
    django 页面调用方法
  • 原文地址:https://www.cnblogs.com/momosmile/p/5035461.html
Copyright © 2011-2022 走看看