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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.