Chapter 8. Basic Controls

You’ve learned Objective-C and the Foundation classes. Now you get to work with the real power of Cocoa: the AppKit user interface layer. There are three ways to use AppKit:

Built-in controls

There’s a vast library of built-in controls that you can start using right away, many of which can be added through Interface Builder. This is great for prototyping, and sometimes you can ship an app using only these stock controls.

Customized versions of built-in controls

You can customize many of the built-in controls using properties, delegate methods, or for more direct customization, subclassing.

Brand-new controls from scratch

Many Mac apps use completely custom views that are tuned for features that are not general enough to be built into Cocoa. For example, the music timeline is something very few apps need, but is absolutely essential for music production software. AppKit provides a comprehensive set of building blocks to help you create custom views for your app.

This chapter focuses on basic concepts using built-in controls. While you’re learning how to use text fields, buttons, and other standard classes, you’ll also be learning about the overall design of AppKit so that you can apply it to your own custom views later.

How to Use This Chapter

Now that you’ve learned the basics of Objective-C and the Foundation classes, you’re probably feeling more confident about trying things out. There are quite a few examples in this chapter. The quickest way to learn about Cocoa’s ...

Get Cocoa and Objective-C: Up and Running 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.