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

    {

    }

  • 相关阅读:
    HttpClient 用法
    HttpURLConnection 用法
    Android 真机连接本地PC服务器
    ArrayList VS Vector
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    Implicit super constructor xx() is undefined for default constructor
    layout_gravity
    gravity
    eclipse 建多层包
    RFC 4585 基于实时传输控制协议(RTCP)反馈的扩展RTP(RTP/AVPF)配置文件
  • 原文地址:https://www.cnblogs.com/zhibin/p/4115989.html
Copyright © 2011-2022 走看看