Search code examples
objective-ccocoanstableviewcocoa-bindings

NSTableView display selected row into NSTextField


I'm a still newbie in cocoa and I've already created NSTableView with buttons to add and remove selected rows. I added NSTextField label to display the values from selected row of the two columns.

Can anyone point me into right direction how to achieve this? I guess that it should work like this:

  1. get selected row index number
  2. get string value of both identifiers in selected row
  3. set string value

also there should be if nothing is selected the string is empty I guess.


Solution

  • Found what I was looking for about the NSTableView bindings.

    https://developer.apple.com/library/mac/#samplecode/NSTableViewBinding/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010522-Intro-DontLinkElementID_2