今天分享ios的事件处理机制,和android的Handler、Looper、MessageQueue类似,具体如下:
The NSResponder class defines the responder chain, an ordered list of objects that respond to user events. When the user clicks the mouse button or presses a key, an event is generated and passed up the responder chain in search of an object that can “respond” to it. Any object that handles events must inherit from the NSResponder class. The core AppKit classes, NSApplication, NSWindow, and NSView, inherit from NSResponder.
The NSResponder class defines the responder chain, an ordered list of objects that respond to user events. When the user clicks the mouse button or presses a key, an event is generated and passed up the responder chain in search of an object that can “respond” to it. Any object that handles events must inherit from the NSResponder class. The core AppKit classes, NSApplication, NSWindow, and NSView, inherit from NSResponder.
本文介绍了iOS中的事件处理机制,包括响应者链的概念及其工作原理。当用户触发鼠标点击或按键事件时,事件将沿响应者链传递,直到找到能够响应的对象。所有处理事件的对象都必须继承自NSResponder类。
234

被折叠的 条评论
为什么被折叠?



