UIPanGestureRecognizer
maximumNumberOfTouches :最大触摸的数量
minimumNumberOfTouches :最少触摸的数量
- translationInView:
translationInView 返回父视图系统当中,返回横坐标,纵坐标上拖动了多少像素(由此可以判断是不是水平移动)
CGPoint translantion = [UIPanGestureRecognizer translationInView:UIView];
ABS(translantion.x)/ABS(translantion.y) > 1
即是判断是否水平移动(x轴拖动距离大于y轴拖动距离)
- velocityInView:
velocityInView 返回指定坐标系统当中拖动的速度,x,y分别代表x轴y轴的拖动速度(矢量)
CGPoint velocity = [UIPanGestureRecognizer velocityInView:UIView];
velocity.x > 0
即是判断是否向右滑动的速度是否大于0
另外顺便记记其他手势基本姿势
UITapGestureRecognizer
numberOfTapsRequired :设置轻击的次数,默认值为1
numberOfTouchesRequired :触点的数量,默认值为1,即手指数UIPinchGestureRecognizer
当两个手指靠近表示zoom-in,当两个手指分离表示zoom-out。
scale
@property(nonatomic) CGFloat scale,放大缩小因子
velocity
@property(nonatomic, readonly) CGFloat velocity ,只读属性 ,表示移动速度UIRotationGestureRecognizer
rotation :旋转角度
velocity :速度UISwipeGestureRecognizer
direction :扫动方向,默认值
UISwipeGestureRecognizerDirectionRight
typedef enum {
UISwipeGestureRecognizerDirectionRight = 1 << 0,
UISwipeGestureRecognizerDirectionLeft = 1 << 1,
UISwipeGestureRecognizerDirectionUp = 1 << 2,
UISwipeGestureRecognizerDirectionDown = 1 << 3
} UISwipeGestureRecognizerDirection;
numberOfTouchesRequired : 触点的数量,默认值为1,即手指数
- UIPanGestureRecognizer
maximumNumberOfTouches :最大触摸的数量
minimumNumberOfTouches :最少触摸的数量 - UILongPressGestureRecognizer
minimumPressDuration :长按最短的时间
numberOfTouchesRequired :
numberOfTapsRequired :
allowableMovement :长按时运行移动的最大距离,默认值为10个像素