O'Reilly logo

Cocoa® by Richard Wentk

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

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 ...

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