iOS提供了方便的手势API(参见编写简单的手势示例:Tap),从iOS3.2开始。在这里介绍了通过手势控制视图的示例:排列和拖动视图

但是,如果要通过手势控制子视图呢?

可以在手势的delegate方法中:

- (void)panPiece:(UIPanGestureRecognizer *)gestureRecognizer{ 
NSLog(@">>gesture…..");

CGPoint location=[gestureRecognizer locationInView:self.view];

UIView *hitView=[self.view hitTest:location withEvent:nil];

NSLog(@">>>%@",hitView);



相关文章:

  • 2022-12-23
  • 2021-10-11
  • 2021-12-07
  • 2021-08-05
  • 2021-11-23
  • 2021-11-26
  • 2021-11-09
  • 2021-05-28
猜你喜欢
  • 2022-12-23
  • 2021-05-26
  • 2021-08-29
  • 2021-12-07
  • 2022-12-23
  • 2021-05-09
  • 2022-12-23
相关资源
相似解决方案