I’m trying to use Bindings with NSOutlineView.
I cannot see how to connect the “currently selected item” to anything else via Bindings
I’ve tried:
- use NSOutlineView directly, bind to
“selection” (doesn’t work; looking at
the docs, Apple hasn’t implemented
that binding) - use an NSArrayController, bind to “arrangedObjects”, and bind the NSAC
to the NSOV’s “selectedRowIndexes”
(doesn’t work; you get a strange
error message that “NSSet cannot be
created from NSIndexSet”; (why not?
surely, one is a subclass of the
other?)
You don’t use
NSArrayControllerfor an outline view, you use anNSTreeController. Then you can just bind toyourTreeController.selectedObjectsif you want to access the selection.NSArrayControlleris for use withNSTableView,NSTreeControlleris for use withNSOutlineView.Apple has a great example showing how to use
NSOutlineViewwithNSTreeController.