Delegates
Delegates and delegate methods are used throughout the Application Kit. Delegates provide an alternative to subclassing when the behavior of classes must be refined to meet an application’s needs. Application Kit classes such as NSApplication, NSWindow, NSBrowser, and NSMatrix are seldom subclassed. Delegation enables all the customization that most applications need.
A delegate is an object that is able to influence the behavior of another object by responding to delegate messages. A class that uses a delegate has a delegate instance variable and defines a number of delegate methods. An instance of that class sends delegate messages to its delegate for help deciding how to behave. For example, the NSWindow class has a delegate and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access