iOS手势篇(五)-UIPanGestureRecognizer详解

UIPanGestureRecognizer是iOS开发中不怎么常用的一个拖动(拖拽)手势.
打开UIPanGestureRecognizer.h头文件

/// 属性
@property (nonatomic)          NSUInteger minimumNumberOfTouches __TVOS_PROHIBITED;   // default is 1. the minimum number of touches required to match
@property (nonatomic)          NSUInteger maximumNumberOfTouches __TVOS_PROHIBITED;   // default is UINT_MAX. the maximum number of touches that can be down
属性默认值说明
minimumNumberOfTouches1识别拖动手势需要的最少的手指数,少于这个数目无法识别
maximumNumberOfTouchesUINT_MAX识别拖动手势限制的最大的手指数,超过这个数目无法识别
///  方法
- (CGPoint)translationInView:(nullable UIView *)view;                        // translation in the coordinate system of the specified view
- (void)setTranslation:(CGPoint)translation inView:(nullable UIView *)view;

- (CGPoint)velocityInView:(nullable UIView *)view;                           // velocity of the pan in points/second in the coordinate system of the specified view
方法说明
- (CGPoint)translationInView:(nullable UIView *)view;获取到的是移动后手指在相对坐标系内移动的距离
- (void)setTranslation:(CGPoint)translation inView:(nullable UIView *)view;一般在Action内计算偏移量的时候,使用该方法将偏移量置位0(偏移量是一直累加的,不会自动清零)
- (CGPoint)velocityInView:(nullable UIView *)view;这个可以获取在View中的手势的平移速度
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值