I’ve been playing with some Cocoa programming again and just spent about the last hour beating my head against a wall. I finally sorted it out. Figured I’d write it down for any other poor soul that hits the same problem.

So, here’s the setup. I’ve got a NIB file with an NSTableView that’s using CoreData to display it’s contents. I’ve also got an NSTextView that is suppost to display the value from the NSTableViews selection.

I created a single Entity with a single attribute, name.

So, I created an NSArrayController and bound it to the desired Entity. I then bound the NSTableView’s content binding to the array controllers arrangedObjects. Then the NSTableColumn had its value bound to the name selector of the arrays arrangedObjects.

The table displayed as expected at this point.

I then bound the NSTextViews value to the array controllers selection with a selector of name. This is where the problem appeared. When the app was first loaded the text field would, correctly, display the first item. Any subsequent selected items wouldn’t change what the text was displaying. (After some fiddling I figured out it wasn’t changing the array controllers selection when I double clicked.)

So, the fix, remove the content binding from the NSTableView. That’s it. Once I’d removed that binding everything worked as I expected it too.

I managed to figure that out by creating a new window, option-dragging the Entity into the window and comparing all of the binding values for everything. Yea, it took me a lot of net searching before trying that. I’m slow.