1、UIGestureRecognizer 介绍手势识别在 iOS 中非常重要,他极大地提高了移动设备的使用便捷性。iOS 系统在 3.2 以后,他提供了一些常用的手势(UIGestureRecognizer 的子类),开发者可以直接使用他们进行手势操作。UIPanGesture ...
1、UIGestureRecognizer 介绍
手势识别在 iOS 中非常重要,他极大地提高了移动设备的使用便捷性。
iOS 系统在 3.2 以后,他提供了一些常用的手势(UIGestureRecognizer 的子类),开发者可以直接使用他们进行手势操作。
UIPanGestureRecognizer(拖动)
UIPinchGestureRecognizer(捏合)
UIRotationGestureRecognizer(旋转)
UITapGestureRecognizer(点按)
UILongPressGestureRecognizer(长按)
UISwipeGestureRecognizer(轻扫)
另外,可以通过继承 UIGestureRecognizer 类,实现自定义手势(手势识别器类)。
PS:自定义手势时,需要 #import <UIKit/UIGestureRecognizerSubclass.h>,一般需实现如下方法:
1 - (void)reset;2 3 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;4 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;5 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;6 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;7 //以上方法在分类 UIGestureRecognizer (UIGestureRecognizerProtected) 中声明,更多方法声明请自行查看
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:iOS 手势操作:拖动、捏合、旋转、点按、长按、轻扫、自定义
关键词:IOS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。