Frage

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?

War es hilfreich?

Lösung

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];
 ...
 ...
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top