O'Reilly logo

Modding Mac OS X by Erica Sadun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

  1. In Interface Builder, select the Term instance in the NIB window. Make sure the associated Terminal design window is visible.

  2. 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 NSWindow class.

  3. Open the Custom Class pane (⌘-5). This pane lets you choose from classes that are closely related to the selected item. Notice that NSWindow is the selected class (it’s highlighted in gray).

  4. Double-click NSPanel. When you do, the NIB window updates to show the NSPanel class, and the Info window shows the class’s attributes.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required