“First Responder” - Did I get that right?

前端 未结 4 1375
轮回少年
轮回少年 2020-12-04 15:38

Let me summarize this shortly: A \"First Responder\" in a nib file is an object, which represents the UI control element that has the user\'s focus. So if the user clicks on

4条回答
  •  情书的邮戳
    2020-12-04 16:09

    A responder is any object that will perform actions (call functions) when events (such as clicking on buttons) occur. The responder chain is a sequence of objects each contained in one another - for example a button inside a panel inside a window. When an event occurs, we iterate through the chain until we find an object that does not have a responder set to nil and which can therefore respond to the event. So instead of providing a responder object for each button in a window, we can provide a single responder for the whole window. The first responder is simply the first object inside the responder chain - linking an event to the first responder allows the event to pass up the chain.

提交回复
热议问题