Chapter 13. Custom Views

Cocoa’s AppKit provides a lot of very flexible view objects. Some more are provided by additional frameworks on OS X, such as the people view from the Address Book framework. For a lot of applications, these are enough to define the user interface. Sometimes, however, you need to define new views.

A view has two main responsibilities, drawing and event handling. We created a simple new view in Chapter 8, although this glossed over most of the complicated aspects of defining a new view.

Cocoa uses a variant of the PostScript drawing model. Traditional PostScript drawing is based around the idea of a path, which is a sequence of curve and line segments. Text was rendered in PostScript by defining a path for each character ...

Get Cocoa® Programming Developer’s Handbook, Second 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.