我在 UIResponder 类引用中读到:
There are two general kinds of events: touch events and motion events.
The primary event-handling methods for touches are touchesBegan:withEvent:, touchesMoved:withEvent:, touchesEnded:withEvent:, and touchesCancelled:withEvent: ...
但另一篇文章,iOS 事件处理指南说:
The first responder is the first view in a window to receive the following type of events and messages: Motion events, Remote-control events, Action messages, Editing-menu messages
所以我很困惑,第二个注释说响应者只处理四个事件——不包括触摸事件——而第一个注释说响应者处理触摸事件。
请让我知道我的误解。
Best Answer-推荐答案 strong>
一次只有一个响应者是第一响应者。此响应者首先查看您引用的四种事件类型。触摸事件总是首先进入被触摸的 View 。在您引用的段落之后的几段中对此进行了解释:
When the system delivers a touch event, it first sends it to a
specific view. For touch events, that view is the one returned by
hitTest:withEvent: ; for “shaking”-motion events, remote-control
events, action messages, and editing-menu messages, that view is the
first responder.
关于objective-c - UIResponder 类和第一响应者角色,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/7961754/
|