"an event couldn't be handled" 是什么意思?

what does it mean when it said "an event couldn't be handled"?

我正在阅读 UIResponder class 的文档,并且遇到了响应链。现在据说,例如,当命中测试无法处理事件时,它会将事件传递给响应者链。那么,有什么例子可以说明一个事件怎么处理不了呢?

来自Event Handling Guide for iOS

If the initial object—either the hit-test view or the first responder—doesn’t handle an event, UIKit passes the event to the next responder in the chain. Each responder decides whether it wants to handle the event or pass it along to its own next responder by calling the nextResponder method. This process continues until a responder object either handles the event or there are no more responders.

“处理”事件的真正含义取决于每个响应者 class。在实现响应器时,您需要做出的决定是,对于每个事件,是否将其传递给下一个响应器。

该部分底部还有一条重要说明:

Important: If you implement a custom view to handle remote control events, action messages, shake-motion events with UIKit, or editing-menu messages, don’t forward the event or message to nextResponder directly to send it up the responder chain. Instead, invoke the superclass implementation of the current event handling method and let UIKit handle the traversal of the responder chain for you.

对于您的响应者是处理触摸事件的 UIView subclass 的最常见情况,所有这些方法都包括:

The default implementation of this method does nothing. However immediate UIKit subclasses of UIResponder, particularly UIView, forward the message up the responder chain. To forward the message to the next responder, send the message to super (the superclass implementation); do not send the message directly to the next responder. For example,

[super touchesBegan:touches withEvent:event];

If you override this method without calling super (a common use pattern), you must also override the other methods for handling touch events, if only as stub (empty) implementations.