Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15. Delegates > Examples in Cocoa

Examples in Cocoa

The following Cocoa classes use a delegate: NSApplication, NSBrowser, NSControl, NSDrawer, NSFontManager, NSFontPanel, NSMatrix, NSOutlineView, NSSplitView, NSTableView, NSTabView, NSText, NSTextField, NSTextView, and NSWindow. The NSOutlineView and NSTableView classes also use a data source. Apple’s WebKit framework also contains several Objective-C classes that use data sources and delegates.

Almost every nontrivial graphical Cocoa application includes an object that acts as the delegate for the application’s shared NSApplication instance. NSApplication provides a little over two dozen delegate methods. They range from -(void)application:(NSApplication *)sender openFiles:(NSArray *)filenames, which you can implement to control how your application opens files, to -(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender, which allows you to control whether the application terminates.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint