NSTableView: Displaying current file icon

Discussion in 'Mac Programming' started by MacDonaldsd, Feb 7, 2008.

  1. MacDonaldsd
    Expand Collapse
    macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #1
    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
     
  2. kainjow
    Expand Collapse
    Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    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.
     
  3. MacDonaldsd
    Expand Collapse
    thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #3
    Thanks again kainjow

    It was quite easy in the end.
     

Share This Page