I'm struggling to setup the correct bindings to make a SourceView (OutlineView) in View-Based mode to work with a TreeController. It does work correctly in Cell-Based mode.
Unfortunately I can't find how to setup header&title text, all I get is empty stuff :≤≤
What I get :
XCode project if you feel like digging in :
https://www.dropbox.com/s/qz3m9p5vd2qvngb/MasterDetail.zip
Took the data from another post :
[
{
"itemName": "Item 1",
"children": []
},
{
"itemName": "Item 2",
"children": [
{
"itemName": "Item 2.1",
"children": []
},
{
"itemName": "Item 2.2",
"children": [
{
"itemName": "Item 2.2.1",
"children": []
},
{
"itemName": "Item 2.2.2",
"children": []
}
]
}
]
},
{
"itemName": "Item 3",
"children": []
}
]
You have to implement at least the -outlineView:viewForTableColumn:item:
so the Outline View knows how to display the data. In your outline View datasource, implement the method like this:
- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
NSView *cellView = [outlineView makeViewWithIdentifier:@"DataCell" owner:self];
return cellView;
}
If tested this is your project and now the cells are displayed. Look at the NSOutlineViewData
/ NSOutlineViewDelegate
Protocols for further informations.