Interface Builder is a great tool if you know what you’re doing. If you don’t it’s a black box.
Cocoa is extraordinarily flexible. Standard GUI element behavior can be changed by overriding class methods, for instance by subclassing. The question then arises: how do I get Interface Builder to use my subclass?
There are three steps:
- Introduce Interface Builder to your subclass: In the classes tab, select the standard widget, then choose “Subclass widget” in the Classes window.
- Place the standard widget where you want your modified widget to appear. By using the standard widget, you’re telling Interface Builder that your modified widget has all the properties of the standard widget: they are API compatible
- Declare the standard widget to use your subclass as “custom class” by switching to the “Custom class” tab inside the inspector (”Show Inspector” in the “Tools” menu) and choosing your subclass. This tells your application to use your subclass instead of the standard widget.