views:

181

answers:

3

I'm looking for Apple documentation regarding the "delegate" and "datasource" methods for NSTableView. They don't appear in the NSTableView Class Reference for some reason. Any idea where I can look? Here's an example of one of them:

- (void)tableView:(NSTableView *)tableView 
   setObjectValue:(id)object 
   forTableColumn:(NSTableColumn *)tableColumn 
              row:(NSInteger)row;

EDIT: It appears they appear in the NSTableView.h file with comments, though that's a pain to browse through. I'd prefer a more user-friendly doc format, if it's available. :)

+3  A: 

The NSTableViewDataSource Protocol Reference and NSTableViewDelegate Protocol Reference contain what you're looking for. There are a number of links to these from the NSTableView Class Reference as well.

Johan Kool
Thanks so much! :)
Dave Gallagher
+1  A: 

This is a common problem. For some reason, Apple documentation does not have a standardize way of linking to pages describing the delegate methods. In some cases, the delegate methods are included as a subheading in the class itself. In others, there are links to the delegate page in the sidebar. Sometimes the links are buried in the text. It's very frustrating.

Just a tip, the delegates are almost always referred and linked to in the "Overview" section of each class document page. If you can't find them in a logical place, look there.

If you need to search for the delegate methods, the protocol is almost always named in a standardized way with the class name followed by "delegate" or "datasource e.g. UIApplicationDelegate, UITableViewDelegate, UITableViewDataSource. You should follow that standard when naming delegates in your own code.

TechZen
Thanks, that's very helpful. This is definitely info that seems to be missing. None of my Obj-C or Cocoa books mention this convention either.
Dave Gallagher
+1  A: 

Keep in mind that if you see a method some place in Xcode, and you want to know what it does, just hold command+option and double click on the method. That will take you to the documentation for that method.

Ultimately, that will lead you here.

Jon Hess