O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSTableDataSource — Mac OS X 10.0

Synopsis

Methods in this informal protocol are implemented by classes that provide the data displayed in an NSTableView. At a minimum, data source classes must implement the methods numberOfRowsInTableView: and tableView:objectValueForTableColumn:row:. Both of these methods are called frequently, so they should be efficient.

@interface NSObject (NSTableDataSource)
                                  // Instance Methods
   - (int)numberOfRowsInTableView:(NSTableView *)tableView;
   - (id)tableView:(NSTableView *)tableView 
                                 objectValueForTableColumn:(NSTableColumn *)tableColumn 
                                 row:(int)row;
   - (void)tableView:(NSTableView *)tableView 
                                 setObjectValue:(id)object 
                                 forTableColumn:(NSTableColumn *)tableColumn
                                 row:(int)row;
   - (BOOL)tableView:(NSTableView *)tv 
                                 writeRows:(NSArray*)rows 
                                 toPasteboard:(NSPasteboard*)pboard;
   - (NSDragOperation)tableView:(NSTableView*)tv 
                                 validateDrop:(id <NSDraggingInfo>)info 
                                 proposedRow:(int)row
                                 proposedDropOperation:(NSTableViewDropOperation)op;
   - (BOOL)tableView:(NSTableView*)tv 
                                 acceptDrop:(id <NSDraggingInfo>)info 
                                 row:(int)row
                                 dropOperation:(NSTableViewDropOperation)op;
@end

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required