I have an NSOutlineView
that is populated from an array via an NSTreeController
. I would like to make it so that rows that have children are not editable and popups in those rows are hidden. You can see my outlineview in the attached screenshot – it's essentially a tree of settings.
How can I go about this or do I need to implement the datasource via a delegate instead of using the NSTreeController to do it?
Have you looked into the delegate methods?
Specifically interesting are
– outlineView:shouldEditTableColumn:item:
which allows to determine if an item can be edited. Just check for children, if item is an parent and return NO;
Hiding the popup buttons depends on how you have setup your NSOutlineView
. In a cell-based outline view use for example
– outlineView:willDisplayCell:forTableColumn:item:
to hide cell content for parent rows. In a view based outline view another method comes into play to customize certain columns:
– outlineView:viewForTableColumn:item:
This should be easy to use to achieve your results.