I have implemented an NSOutlineView in a simple OS X project. I am using the project generated NSViewController object to host the NSOutlineView and set the _outlineView.dataSource = self; where self is the NSViewController. I have implemented the required NSOutlineViewDataSource methods all of which are called as expected but instead of my simple data being displayed I observe the following (any tips would be appreciated):
Here is my NSViewController implementation:
#import "ViewController.h"
@implementation ViewController- (void)viewDidLoad
{
[super viewDidLoad];
dataSource = @[@"One", @"Two", @"Three", @"Three", @"Four"];
outlineView.dataSource = self;
}
- (void)setRepresentedObject:(id)representedObject
{
[super setRepresentedObject:representedObject];
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
{
return [dataSource objectAtIndex:index];
}
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
{
return NO;
}
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
{
return [dataSource count];
}
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn: (NSTableColumn *)tableColumn byItem:(id)item
{
return item;
}
@end