mac_ch8.eps
co_bar.eps

Chapter 8: Building an Application with Interface Builder

mac_chbox8.eps

In This Chapter

Designing a project in Interface Builder

Understanding links, outlets, and actions

Using advanced UI techniques

Now that you have had an introduction to Interface Builder (IB), you are ready to use it to build a simple application. This application will use a simple UI created in IB that links nib objects with code. It runs a simple timer, controlled by two buttons. The button text changes according to the application state, and the count appears in a large font.

Designing a Project in Interface Builder

First, in Xcode, choose File New Project, click the Application item under the Mac OS X section, select the Cocoa Application template, and click the Choose button. Save the project as Counter. Open the Resources group, and double-click MainMenu.xib to launch IB and load the nib file for editing. After IB loads, choose Window Bring All To Front.

If the Library window isn't visible, choose Tools Library. If the Edit window isn't visible, double-click Window (Counter) in the Doc window. You should see a collection of windows similar to the one shown in Figure 8.1.

The position, size, and layout of the ...

Get Cocoa® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.