UIPanGestureRecognizer
maximumNumberOfTouches :最大觸摸的數(shù)量
minimumNumberOfTouches :最少觸摸的數(shù)量
- translationInView:
translationInView 返回父視圖系統(tǒng)當(dāng)中寸认,返回橫坐標(biāo)鹃觉,縱坐標(biāo)上拖動(dòng)了多少像素(由此可以判斷是不是水平移動(dòng))
CGPoint translantion = [UIPanGestureRecognizer translationInView:UIView];
ABS(translantion.x)/ABS(translantion.y) > 1
即是判斷是否水平移動(dòng)(x軸拖動(dòng)距離大于y軸拖動(dòng)距離)
- velocityInView:
velocityInView 返回指定坐標(biāo)系統(tǒng)當(dāng)中拖動(dòng)的速度妇智,x,y分別代表x軸y軸的拖動(dòng)速度(矢量)
CGPoint velocity = [UIPanGestureRecognizer velocityInView:UIView];
velocity.x > 0
即是判斷是否向右滑動(dòng)的速度是否大于0
另外順便記記其他手勢(shì)基本姿勢(shì)
UITapGestureRecognizer
numberOfTapsRequired :設(shè)置輕擊的次數(shù),默認(rèn)值為1
numberOfTouchesRequired :觸點(diǎn)的數(shù)量歇攻,默認(rèn)值為1,即手指數(shù)UIPinchGestureRecognizer
當(dāng)兩個(gè)手指靠近表示zoom-in,當(dāng)兩個(gè)手指分離表示zoom-out赡磅。
scale
@property(nonatomic) CGFloat scale,放大縮小因子
velocity
@property(nonatomic, readonly) CGFloat velocity 宝与,只讀屬性 焚廊,表示移動(dòng)速度UIRotationGestureRecognizer
rotation :旋轉(zhuǎn)角度
velocity :速度UISwipeGestureRecognizer
direction :掃動(dòng)方向,默認(rèn)值
UISwipeGestureRecognizerDirectionRight
typedef enum {
UISwipeGestureRecognizerDirectionRight = 1 << 0,
UISwipeGestureRecognizerDirectionLeft = 1 << 1,
UISwipeGestureRecognizerDirectionUp = 1 << 2,
UISwipeGestureRecognizerDirectionDown = 1 << 3
} UISwipeGestureRecognizerDirection;
numberOfTouchesRequired : 觸點(diǎn)的數(shù)量习劫,默認(rèn)值為1咆瘟,即手指數(shù)
- UIPanGestureRecognizer
maximumNumberOfTouches :最大觸摸的數(shù)量
minimumNumberOfTouches :最少觸摸的數(shù)量 - UILongPressGestureRecognizer
minimumPressDuration :長(zhǎng)按最短的時(shí)間
numberOfTouchesRequired :
numberOfTapsRequired :
allowableMovement :長(zhǎng)按時(shí)運(yùn)行移動(dòng)的最大距離,默認(rèn)值為10個(gè)像素