zoukankan      html  css  js  c++  java
  • GestureRecognizer

    UIGestureRecognizer基类是一个抽象类,我们主要是使用它的子类(名字包含链接,可以点击跳到ios Developer library,看官方文档):

    UITapGestureRecognizer

    UIPinchGestureRecognizer

    UIRotationGestureRecognizer

    UISwipeGestureRecognizer

    UIPanGestureRecognizer

    UILongPressGestureRecognizer

    从名字上我们就能知道, Tap(点击)、Pinch(捏合)、Rotation(旋转)、Swipe(滑动,快速移动,是用于监测滑动的方向的)、Pan (拖移,慢速移动,是用于监测偏移的量的)以及 LongPress(长按)。

    - (void)viewDidLoad

    {

        [super viewDidLoad];

        UITapGestureRecognizer *gesture=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick:)];

        [self.view addGestureRecognizer:gesture];

        gesture.numberOfTapsRequired=1;

        gesture.numberOfTouchesRequired=1;

        

    }

    -(void)tapClick:(UITapGestureRecognizer *)gesture{

    }

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event  //手指触摸屏幕时报告UITouchPhaseBegan事件

    {

    }

    - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event   //在手指在屏幕上移动时报告UITouchPhaseMoved事件

    {

    }

    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event   //在手指离开屏幕时报告UITouchPhaseEnded事件

    {

    }

    - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event    //在因接听电话或其他因素导致取消触摸时报告

    {

    }

  • 相关阅读:
    APUE_1.7ErrorHandling Figure1.8Demonstrate strerror and perror
    4-7 使用tf.train.slice_input_producer读取列表样本
    Ubuntu16.4+github+pycharm
    4-5 Cifar10数据集解析
    4-6 TF之TFRecord数据打包案例
    matlab如何创建一个视频预览
    Alpha
    如何使用 declare-styleable
    LayoutParams使用
    桌面快捷方式的问题-创建-删除-判断
  • 原文地址:https://www.cnblogs.com/zhibin/p/4115989.html
Copyright © 2011-2022 走看看