This has been befuddling me for hours...
I have an object (CuesDoc) with a property (NSMutableArray *cuesArray)
and some other properties. The cues
array holds multiple Cue
objects. There is a property called (CuesDoc*) currentCuesDoc
in my AppDelegate
.
In IB, I have an NSArrayController
, which is bound to the AppDelegate.currentCuesDoc.cuesArray
.
I have a view-based NSTableView
which is bound to the NSArrayController
and can add/remove/edit values in the table and cuesArray. So far so good.
I have detail fields below that, which are bound to NSArrayController.selection
, with the model key path set to each property.
When the view first appears, the detail fields populate with the contents of the first item in the table view, however when I select other rows, the detail fields do not update to reflect the current selection.
I added an observer to selectionIndexes
and selection
for the NSArrayController
, and when the view appears, I get called for the observeValueForKeyPath:
method once, but not after changing selections.
For view-based NSTableView
s, you must bind the tableView's selection indexes to the array controller key of selectionIndexes
to keep the view's selection in sync with the controller's selection. Selection bindings are separate from content bindings. The older, cell-based NSTableView
APIs did not require this step.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With