手势
来源:互联网 发布:婚礼送多少钱 知乎 编辑:程序博客网 时间:2024/05/01 07:13
轻拍(tap)
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
//设置轻拍次数(默认1)(按2次好使)
tap.numberOfTapsRequired = 2;
//设置轻拍的手指个数(默认1)
// tap.numberOfTouchesRequired = 2;
轻扫(swipe)
//默认从左往右
UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipe:)];
[imageView addGestureRecognizer:swipe];
//要么上下一起 要么左右一起(下面的写法只能执行左右)
swipe.direction = UISwipeGestureRecognizerDirectionDown | UISwipeGestureRecognizerDirectionLeft | UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionUp;
//设置轻扫手指个数
swipe.numberOfTouchesRequired = 2;
捏合(pinch)
UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinch:)];
[imageView addGestureRecognizer:pinch];
旋转 (Rotation)
UIRotationGestureRecognizer *rotation = [[UIRotationGestureRecognizer alloc]initWithTarget:self action:@selector(rotation:)];
[imageView addGestureRecognizer:rotation];
平移(Pan)
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
[imageView addGestureRecognizer:pan];
长按(LongPress)
UILongPressGestureRecognizer *longpress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longpress:)];
[imageView addGestureRecognizer:longpress];
//长按时间
longpress.minimumPressDuration = 1;
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 手势
- 不用算术运算符实现两个数的加法
- 【Leetcode】Kth Smallest Element in a BST
- Zookeeper 注册中心解析
- OAuth2.0 学习笔记
- 【编程之美】求最大公约数
- 手势
- RF Test and Measurement-1
- Android之在不同的Activity之间传递数据
- 第一章 USB Type C的基本原理(连载一)
- 单片机学习之点亮LED小灯
- ngxin proxy_set_header Host X-Forwarded-For
- 图片数组形成动画(UIImageView)
- FTGL在OpenGL下显示中文
- 棋牌源码开发下载时时快乐十分程序开发北京赛车平台架设