2

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
oregonduckman
  • 389
  • 2
  • 13
  • You are missing a few parts. look here; http://stackoverflow.com/questions/10084254/how-do-i-make-a-simple-view-based-nsoutlineview – john elemans Jan 29 '16 at 23:20

0 Answers0