iphone上的手势操作有许多种,包括轻击、触摸、拖动、轻扫等。开发中与四个方法有很大关联:

  • – touchesBegan:withEvent:
  • – touchesMoved:withEvent:
  • – touchesEnded:withEvent:
  • – touchesCancelled:withEvent:
四个方法的参数都是(NSSet *) touches  及(UIEvent *)event。
 
touches 中的每一个对象都是一个UITouch事件。
 

NSUInteger numTaps = [[touches anyObject] tapCount];  


NSUInteger numTouches = [touches count]; 


UITouch *touch = [touches anyObject];

CGPoint point = [touch locationInView:self]; 


现在用得比较多的时利用ios里面的Automatic Gesture Recognition方式实现,其主要用到的类是UIGestureRecognizer的各种子类。。。

相关文章:

  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2021-10-22
  • 2021-09-08
  • 2022-12-23
  • 2021-10-24
猜你喜欢
  • 2021-05-30
  • 2021-11-16
  • 2021-09-04
  • 2022-12-23
  • 2021-05-30
  • 2021-07-10
  • 2021-09-24
相关资源
相似解决方案