I'm currently trying to use Cocoa Bindings to populate a NSTableView using Cocoa Bindings. I encounter a major problem with some columns where I use custom NSCell subclass.
My XIB file contains a NStableView and a NSArrayController.
In interface Builder, when you set a NSTextFieldCell or a NSImageCell as the datacell of a column, you are able to bind the "value" property of the cell to the ArrayController. When you set a NSCell as the datacell of a NSTableColumn, there is no "Value" binding available in Interface Builder. So you can deduce that bindings should be done programmatically.
When you try to bind programmatically the "value" property to the "arrangedObjects.property" of the NSArrayController, an error raises that says :" this class is not key value coding-compliant for the key value". And effectively, there is no "value" property exposed when you call the exposeBindings: method, there is no "value" property.
How do you elegantly binds an NSArrayController to a NSTableColumn that has a custom subclass of NSCell ?
To solve this problem, create a subclass of
NSTableColumn
and reimplement thedataCellForRow:
method. Finally, in your XIB, change the column type to your new subclass class.