NSControl继承

来源:互联网 发布:淘宝活动氛围图是什么 编辑:程序博客网 时间:2024/05/12 11:43

 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:retainreleasedealloc, and initNSResponder is a subclass of NSObject. Responders have the ability to handle events with such methods as mouseDown: and keyDown:NSView is a subclass of NSResponderNSView 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.

0 0