O'Reilly logo

Learning Cocoa with Objective-C, 2nd Edition by James Duncan Davidson, Apple Computer Inc

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

Chapter 5. Graphical User Interfaces

Now that we’ve covered the Foundation, we’re going to take a step up and start working with the AppKit framework to create GUI-based applications. In this chapter, we’ll build a single-window application from beginning to end, letting us introduce the various GUI subjects necessary to become proficient with Cocoa programming. For the first time, you’ll see the complete workflow typical of Cocoa application development, composed of the following steps:

  1. Design the application.

  2. Create the project using Project Builder.

  3. Create the interface using Interface Builder.

  4. Define the classes using Interface Builder.

  5. Connect the Model, View, and Controller objects using Interface Builder.

  6. Implement the classes using Project Builder.

  7. Build and run the project using Project Builder.

The application we’ll build in this chapter is a currency converter—a simple utility that converts a dollar amount to an amount in some other currency. This example has been one of the mainstay examples of NeXTSTEP/OpenStep/Cocoa programming; it’s been around almost long enough to reach “Hello World” status. Although it is a simple application, it consolidates quite a few of the concepts and techniques needed to get started with writing Cocoa GUI applications.

After working through this first complete GUI application, we’ll spend the rest of this section of the book exploring in-depth the topics introduced in this chapter.

Graphical User Interfaces in Cocoa

Graphical user interfaces ...

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