Changing Object Classes
Just because an interface object belongs to a certain class doesn’t necessarily mean that it has to remain that way. In the following example, you’ll discover that it’s fairly simple to change classes to add extra capabilities to an application. Changing classes may create new attributes (as it does in this example) or offer new Outlets and Actions. Use the Custom Class pane to look for possible options; you may find a better class to suit your needs.
In Interface Builder, select the Term instance in the NIB window. Make sure the associated Terminal design window is visible.
In the Info window, open the Attributes pane (⌘-1). The titlebar of the Info window says “NSWindow Info,” indicating the Term instance’s type. Notice that the Utility Window feature is grayed out; it is not available to the
NSWindowclass.Open the Custom Class pane (⌘-5). This pane lets you choose from classes that are closely related to the selected item. Notice that
NSWindowis the selected class (it’s highlighted in gray).Double-click NSPanel. When you do, the NIB window updates to show the
NSPanelclass, and the Info window shows the class’s attributes.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access