Interface Builder is Apple's graphical tool for creating and editing the user interfaces of Cocoa and Carbon applications. It is part of the free developer tools included with Mac OS X.

The application is incredibly easy to use, allowing a developer to just drag and drop widgets and other user interface components such as tabbed panes and dialog boxes from a palette. It even allows the connections between Cocoa objects to be created by dragging. The necessary classes are created and loaded ready to edit in Project Builder. Formatters can be applied to text fields so, for example, a date is always shown correctly. One checkbox can turn on continuous spell checking in any text field. It will also check the spelling within the interface too - don't want to go misspelling menu items, do we.

Interface Builder first made an appearance in NeXTStep, and was updated for Cocoa and Carbon development under Mac OS X. Much of the really clever stuff can only be done using Cocoa

Apple is well known for its strict Human Interface Guidelines. Compliance with these is made easy with the "snap to Aqua guidelines" option, which aligns your widgets automatically. You can preview the interface at any time, even before you've written the necessary code, by choosing "Test Interface". As well as letting you play with menu items, click buttons, resize windows and so forth, this mode also allows the connections between Cocoa objects to be tested.

All the interface components are stored as nib files, which are XML representations of all the UI resources. You can create several localized versions of your UI, store them as nib files, and they will be loaded according which language the user has chosen in their preferences. Nifty!

Menu items can be edited just by double clicking on them and typing the text in, and keyboard shortcuts can also be assigned. This gets rid of a lot of the annoying Carbon Event chores.

The implementation of this is very elegant, mainly as a result of the Objective-C language and Cocoa, which lends itself very well to this. It has dozens of high level classes for all of these UI elements already. If a language is nicely object oriented, why not begin your projects by creating and arranging the objects that forming the basis of it in an nice graphical application like this?

One fun thing to do is to open the application bundle of your favourite Cocoa app, and edit it's nib files in Interface Builder. You can completely rearrange the interface, changing pretty much anything, but as long as the connections stay in place the application should still work fine. This also allows an advanced kind of the ResEdit hacking that was popular with Mac users under OS 9 and earlier. The ultimate skins for any Cocoa application! Or maybe you just don't like the keyboard shortcuts in an application. No problem: just open the nib file and you can change them.

ascorbic accepts no responsibility for the destruction of software if you decide you'd like Mail to have all its text in celtic runes, and all the buttons replaced with porn. Always make a backup!

In summary, this is user interface development, Apple style. You may not like these fancy high-level editors, prefering to carefully hand code your GUI in vi, but you can't deny the time saving benefits of a tool like this. You can create a fully-functional GUI for you app in a matter of minutes, which leaves a lot more time for the important parts of your development.

http://developer.apple.com/tools/interfacebuilder
http://www.stepwise.com

Log in or register to write something here or to contact authors.