basis gestrues
include:
Tap :To press or select a control or item(analous to a single mouseclick) .
Drag:
Flick: To scroll pan quickly
Swipe:
Double Tap:
Pinch
Open:
Pinch close:
Touch and hold:
Shake::
可以通过4个方法通知响应者有关触摸和手势的情况,当用户第一次触摸屏幕时,iphone将查找touchesbegan:方法响应者。
若要查清用户第一次开始进行的手势或者轻击屏幕的时间。请再视图或者控制器中实现这个方法。
touchesbegan:
{
NSUInteger numTaps=[[touches anyObject] tapcount];
NSUIteger
numtouches=[touches count];
}
轻扫的代码:
首先在touchesBegan里 获得初始位置
代码如下
UITouch*touch=[touches anyObject];
gestureStarPoint=[touch locationInView:self.view];
首先设定最小纵向长和最大横向长
如:kMinimnumGestureLength
KMaxmnumGestureVariance
然后在move方法里边代码如下
CGFloatKmininumlenth=12,KmaxnumVariance=36;
UITouch*touch=[touches anyObject];
CGPointcurrentPoint=[touch locationInView:self.view];
CGFloatdeltaX=fabsf(gestureStartPoint.x-currentPoint.x);
CGFloatdeltaY=fabsf(gestureStartPoint.y-currentPoint.y);
if(deltaX>=Kmininumlenth&&deltaY<=KmaxnumVariance){
}
else
if(deltaY>=Kmininumlenth&&deltaX<=KmaxnumVariance){
///
}
include:
Tap :To press or select a control or item(analous to a single mouseclick) .
Drag:
Flick: To scroll pan quickly
Swipe:
Double Tap:
Pinch
Pinch
Touch and hold:
Shake::
可以通过4个方法通知响应者有关触摸和手势的情况,当用户第一次触摸屏幕时,iphone将查找touchesbegan:方法响应者。
若要查清用户第一次开始进行的手势或者轻击屏幕的时间。请再视图或者控制器中实现这个方法。
touchesbegan:
{
}
轻扫的代码:
首先设定最小纵向长和最大横向长
如:kMinimnumGestureLength
///