To better understand NSControl, you should become acquainted with its ancestors: NSControl inherits from NSView, which inherits from NSResponder, which inherits from NSObject. Each member of the family tree adds some capabilities (Figure 5.3).
Figure 5.3. Inheritance Diagram for NSControl

At the top of the class hierachy is NSObject. All the classes inherit from NSObject, and this is where they get the basic methods:retain, release, dealloc, and init. NSResponder is a subclass of NSObject. Responders have the ability to handle events with such methods as mouseDown: and keyDown:. NSView is a subclass of NSResponder. NSView has a place on a window, where it draws itself. You can create subclasses of NSView to display graphs and allow the user to drag and drop data. NSControl inherits from NSView and adds the target and the action.
本文深入探讨了NSControl的家族树结构,从NSObject到NSResponder再到NSView,最终到达NSControl,阐述了每个成员的独特功能和作用。
3590

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



