iOS 手势详解

作者: 方同学哈 | 来源:发表于2015-12-20 23:39 被阅读298次

前言

iOS中有很多常用的手势,比如单击、双击、缩放、拖拽等等。接下来,我为大家来一一介绍一下这些手势的使用。

正文

单击
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)];  
singleTap.numberOfTapsRequired = 1;    
[self.view addGestureRecognizer:singleTap];
双击
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)];    
doubleTap.numberOfTapsRequired = 2;    
[self.view addGestureRecognizer:doubleTap];
左滑
UISwipeGestureRecognizer *leftSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)];    
leftSwipe.direction = UISwipeGestureRecognizerDirectionLeft;    
[self.view addGestureRecognizer:leftSwipe];
右滑
UISwipeGestureRecognizer *rightSwipe = [[UISwipeGestureRecognizer alloc]                                            initWithTarget:self action:@selector(processgestureReconizer:)];    
rightSwipe.direction = UISwipeGestureRecognizerDirectionRight;    
[self.view addGestureRecognizer:rightSwipe];
拖拽
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)];    
[self.view addGestureRecognizer:pan];
缩放
UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)];    
[self.view addGestureRecognizer:pinch];
旋转
UIRotationGestureRecognizer *rotation = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)];    
[self.view addGestureRecognizer:rotation];
长按
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)];    
longPress.minimumPressDuration = 2.0;    
[self.view addGestureRecognizer:longPress];

相关文章

  • iOS 事件以及手势的处理

    iOS 事件以及手势的处理 首先引用深入浅出iOS事件机制,iOS触摸事件处理详解,详解iOS触摸事件与手势识别三...

  • IOS学习(7)-UIGestureRecognizer

    iOS开发之手势gesture详解

  • iOS 侧滑返回详解

    iOS 侧滑返回详解 BBGestureBack iOS 全屏手势返回 滑动返回 pop 动画效果 这种手势主流A...

  • iOS 手势详解

    手势识别 手势识别器将抽像度低的事件操作转化为更容易理解的动作,它们是附加在视图上的对象,并允许对这些动作进行回应...

  • iOS 手势详解

    前言 iOS中有很多常用的手势,比如单击、双击、缩放、拖拽等等。接下来,我为大家来一一介绍一下这些手势的使用。 正...

  • react-native实现画笔功能

    ART相关 react-native之ART 配置IOS 参考 react-native之ART绘图详解 手势相关...

  • iOS手势识别详解

    一.UIEvent,UITouch在触摸处理中的作用 在iOS系统中,当用户手指开始接触屏幕到所有手指都离开屏幕,...

  • ios 右滑返回和边缘右滑返回

    以下两篇文章可以解决所有的右滑问题 参考 iOS | 全屏右滑返回详解 iOS右滑返回手势深度全解和最佳实施方案

  • iOS 手势返回

    iOS 手势返回 BBGestureBack iOS 全屏手势返回 滑动返回 pop 动画效果 这种手势主流App...

  • iOS指纹解锁和手势解锁

    iOS指纹解锁和手势解锁 iOS指纹解锁和手势解锁

网友评论

本文标题:iOS 手势详解

本文链接:https://www.haomeiwen.com/subject/dudmhttx.html