Search code examples
objective-ccocoacocoa-bindings

Bind NSSlider with NSTableView


Data: An entity with an attribute 'page' (int).

Interface:
NSSlider- value is bound to NotesController.selection.page
NSTableView- value of column 1 is bound to NotesController.arrangedObjects.page

I want to be able to interact with either component and have the change be reflected in both. Above setup works perfectly when I switch between rows in tableview (the slider goes to the corresponding value). However when I play around with slider it changes the value of the selected row instead of changing the index of selected row. This is obviously easily fixable with target/action but is there any workaround that only uses bindings? Thanks.


Solution

  • You need to bind your slider's value to NotesController.selectionIndex.