iphone 手势编程---值得回忆的API

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){
///
                  }
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值