Tag: 触碰事件

只将触摸事件转发给正在触摸的视图

我有一个文本字段,一个button和一个表的UIWindow。 我希望能够跟踪屏幕上的所有触摸,然后将它们转发到正在触摸的元素。 我已经阅读了苹果文档覆盖sendEvent ,但我仍然不明白: 如何使用hitTest来检索被触摸的元素 如何前进触摸 这是我迄今为止。 – (void) sendEvent:(UIEvent *)event { for (UITouch *touch in [event allTouches]) { /* Get coordinates of touch */ CGPoint point = [touch locationInView:self]; /* Get subview being touched */ /* something like this??? UIView *receiver = [self hitTest:point withEvent:event]; */ /* Forward touch event to right view */ […]