1

I want to display data in an NSOutlineView. I have an NSTreeNode with data, but I don't know how to display the contents of the NSTreeNode in an NSOutlineView.

I have wasted a lot of time googling buy I couldn't found anything which could full-fill my requirement.. Can anyone help me?

Surjeet Singh
  • 11,691
  • 2
  • 37
  • 54

1 Answers1

1

The best thing to do is to study the example DragNDropOutlineView, Getting data wrapped inside the NSTreeNode is easy, you simply access to the representedObject property

For example take a look at (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item present in DragNDropOutlineView, where item is an NSTreeNode instance

- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
    id objectValue = nil;
    SimpleNodeData *nodeData = [item representedObject];
 ...
 ...
}
dafi
  • 3,492
  • 2
  • 28
  • 51