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    //在因接听电话或其他因素导致取消触摸时报告

    {

    }

  • 相关阅读:
    C# Socket 入门2(转)
    C# Socket 入门1(转)
    StructLayout特性(转)
    [转载]U3d常规性能优化技巧
    Python语言系统学习(七)
    Python语言系统学习(五)
    python语言系统学习(六)
    python语言系统学习(四)
    白话经典算法-常见排序算法的实现与性能比较
    最快的内容查找算法-----暴雪的Hash算法
  • 原文地址:https://www.cnblogs.com/zhibin/p/4115989.html
Copyright © 2011-2022 走看看