The graphical user interface is one of the defining features of modern computers. No personal computer sold to consumers these days lacks a GUI, and the only time people work with a machine that doesn’t present information graphically is when they’re working with a server, supercomputer, or other specialized tool. Displaying a graphical interface to your user is fundamental to developing with Cocoa, and understanding both how to design an appealing and usable GUI and how to implement that GUI are critical skills for Cocoa developers.
This chapter covers the user interface system available in Cocoa and Cocoa Touch, in addition to implementing a UI. Designing a usable and pleasant UI is a huge topic that wouldn’t fit in this chapter (let alone in this book!), so if you’re interested in learning about what makes a user interface great, take a look at Tapworthy by Josh Clark (O’Reilly). You’ll also learn about Core Animation, the animation system on both OS X and iOS.
While both iOS devices and OS X present their interfaces via a screen, the differences in how they accept user input mean that these interfaces are quite different.
On OS X, the top-level object is the window. Windows contain controls, such as buttons, labels, and text fields, and can be moved around the screen to suit the user. More than one window is displayed on the screen at a time. Some windows can be resized, which means that windows need to know how to ...