Binding view-based NSOutlineView to Core Data

前端 未结 4 803
栀梦
栀梦 2021-01-31 11:26

I\'m trying to implement the new view-based OutlineView as a source list in my Mac app. I can\'t get values to display, though, so I made a small test app from the Core Data app

4条回答
  •  渐次进展
    2021-01-31 11:55

    This appeared to be a change for Xcode 4 or thereabouts. Interface builder adds two NSTableCellView objects under the NSOutlineView. If you delete the NSTableCellView objects you return to a saner (or at least documented) world where you need would implement the methods:
    outlineView:dataCellForTableColumn:item outlineView:willDisplayCell:forTableColumn:item

    ...or at least you do if you want a source list look. In any case this is how the SourceView sample is setup and is why, when you try to recreate the SourceView sample that you can get in such a mess.

    Alternatively if you want to continue to use the NSTableCellView objects (which are quite useful) then you can:

    • bind the NSOutlineView 'Content' to your TreeController.arrangedObjects

    • bind the NSTextField (and/or NSImageView) under NSTableCellView to 'Table Cell View' with a model key path of objectValue.< key >

提交回复
热议问题