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

Get Learning Cocoa with Objective-C, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.