tailieunhanh - Lập trình Wrox Professional Xcode 3 cho Mac OS part 36
Một lớp con riêng của NSView. Một lớp con riêng của NSObject đó không phải là một lớp con của NSView. Bất kỳ lớp đó xuất hiện trong bảng thư viện, hoặc lớp một tuỳ chỉnh của một đối tượng xuất hiện trong bảng thư viện. | 274 CHAPTER 13 INTERFACE BUILDER The following table describes exactly how objects in a nib document are constructed at run time OBJECT TYPE DESCRIPTION INITIALIZER Custom View Objects A custom subclass of NSView. - initWithFrame Non-View Custom Objects A custom subclass of NSObject that is not a subclass of NSView. -init Interface Builder Classes Any class that appears in the library palette or a custom subclass of an object that appears in the library palette. -initWithCoder Constructing custom view objects with -initWithFrame makes them compatible with the normal programmatic initialization of NSView objects -initWithFrame is NSView s designated initializer . All non-view custom objects are constructed with the standard -init message. This means that you don t have to make your class conform to NSCoding in order to include it in a nib file. The objects defined in the Interface Builder palette all conform to NSCoding and are initialized using the standard decoding method -initWithCoder . The attribute values that you set in the inspector panels are decoded from the archive data stream. If you create a custom subclass of an Interface Builder object that s constructed with -initWithCoder your class will initialize itself with -initWithCoder too. That s the only way that attributes set for its superclasses can be read at run time. Custom NSObject subclasses can be initialized with -init because there are no editable properties for custom classes only outlets and actions. Nothing needs to be read from the archive stream during initialization. After the objects in the nib file are constructed two more things happen 1. All of the connections are set. 2. Every object receives an -awakeFromNib message. If your object needs to perform any additional initialization especially any initialization that depends on connections it should implement a - void awakeFromNib method. PLACEHOLDER OBJECTS A subject I ve been avoiding is what those other mysterious objects in your nib .
đang nạp các trang xem trước