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

NSOutlineViewDataSource — Mac OS X 10.0

Synopsis

Methods in this informal protocol are implemented by classes that provide the data contents for an NSOutlineView. An NSOutlineView data source delegate object must implement the following four required methods of the protocol: outlineView:child:ofItem:, outlineView:isItemExpandable:, outlineView:numberOfChildrenOfItem:, outlineView:objectValueForTableColumn: byItem:.

In each of these four methods, outlineView: is the NSOutlineView object invoking the method. Every outline view has a root item. In the invocation of the data source methods, an outline view indicates a root item as nil. Thus, if outlineView:numberOfChildrenOfItem: was invoked with nil at the item, the implementation of this method would return the number of children items for the root item.

@interface NSObject (NSOutlineViewDataSource)
                                  // Instance Methods
   - (id)outlineView:(NSOutlineView *)outlineView 
                                 child:(int)index 
                                 ofItem:(id)item;
   - (BOOL)outlineView:(NSOutlineView *)outlineView 
                                 isItemExpandable:(id)item;
   - (int)outlineView:(NSOutlineView *)outlineView  
                                 numberOfChildrenOfItem:(id)item;
   - (id)outlineView:(NSOutlineView *)outlineView 
                                 objectValueForTableColumn:(NSTableColumn *)tableColumn
                                 byItem:(id)item;
   - (void)outlineView:(NSOutlineView *)outlineView v  
                                 forTableColumn:(NSTableColumn *)tableColumn 
                                 byItem:(id)item;
   - (id)outlineView:(NSOutlineView *)outlineView 
                                 itemForPersistentObject:(id)object;
   - (id)outlineView:(NSOutlineView *)outlineView 
                                 persistentObjectForItem ...

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