Custom Controls

Cocoa offers a rich set of user interface controls. Even so, there are times when a custom control is desired. Usually, the controls provided in Cocoa are sufficient if enough creativity is employed. New kinds of controls can be confusing to users, so they should be avoided unless absolutely necessary.

Much of the time it is possible to subclass an existing control, making just a minor alteration in the standard behavior. Because each control is a little different, it is beyond the scope of this book to show the subtle details of how to subclass every kind of control. Instead, an example of subclassing the NSControl and NSActionCell classes directly is shown. The techniques used in the example show more about the internals of ...

Get Cocoa® Programming 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.