Master Data, NSTableColumn Bindings, and Custom NSCell
I am trying to render an array NSManagedObjects
in NSTableView
using a custom NSCell
one that can draw the managed object correctly.
In this case, one column of mine is NSTableView
bound to arrangedObjects
a NSArrayController
. I am not using any key paths on the object.
I was under the impression that my subclass NSCell
would receive a message setObjectValue:
when the table view wants to draw a specific item, but it doesn't. But it doesn't even work as it NSManagedObjects
doesn't follow the protocol Copying
.
I suspect this is a common task and that there must be some easy way to do it, but I really don't see it right now.
Any insight would be appreciated.
source to share
You need to bind to a specific property of related objects. If you really need a single cell to draw the entire value, you should bind to objectID
as Martin suggests, but instead of resampling in your drawing cells, you can use a delegate method -tableView:willDisplayCell:forTableColumn:row:
to set an object as the value for a custom cell property from an array controller, avoiding both copying. so and choice.
source to share