PDA

View Full Version : NSTableView: Displaying current file icon




MacDonaldsd
Feb 7, 2008, 07:04 AM
Hi all,

Im sure I have seen an example of how to do this before but I can't find it now. Basically I am using CoreData and bindings to populate a NSTableView and I would like to have a column that display icons for each file. I currently store the URL to the file so is there a way of doing this with bindings ?

Thanks again



kainjow
Feb 7, 2008, 08:51 AM
I think NSValueTransformer is your friend here. I think you need to bind your image column to your URL (which I'm assuming is in CoreData) and then assign it a custom NSValueTransformer that takes the URL and returns an image from it (NSWorkspace). Check out the NSValueTransformer docs and sample code.

MacDonaldsd
Feb 7, 2008, 02:38 PM
Thanks again kainjow

It was quite easy in the end.