• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArrayController & image in column
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController & image in column


  • Subject: Re: NSArrayController & image in column
  • From: Dave DeLong <email@hidden>
  • Date: Tue, 19 Apr 2011 14:31:22 -0700

You could use a custom NSValueTransformer.

Subclass NSValueTransformer and have the -transformValue accept one of the objects from your NSArray, and then uses that object to return the appropriate NSImage.  Then when you're setting up your bindings, simply type in the name of your NSValueTransformer in the "Value Transformer" field.

Dave

On Apr 19, 2011, at 2:26 PM, Todd Heberlein wrote:

> I want to have an NSTableView controlled by an NSArrayController using an NSArray data source. In one of the columns I want to display one of several images. The choice of image will be based on an integer value in one of the fields of the array.
>
> What is the best or most recommended way to do this?
>
>
> Should I add to my NSArray object a field for an NSImage field (with getter/setter) and automatically load the image into the NSArray object, and then use that the getter for the NSImage as the key in the NSArrayController?
>
> Should I subclass NSTableColumn and override
> 	-dataCellForRow:?
>
> Should I use a delegate for the NSTableView and override
> 	-tableView:dataCellForTableColumn:row:?
>
> Can I even use a custom NSTableColumn or NSTableView delegate with a table controlled by an NSArrayController?
>
> Thanks,
>
> Todd
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSArrayController & image in column (From: Todd Heberlein <email@hidden>)

  • Prev by Date: NSArrayController & image in column
  • Next by Date: Re: How call upper layer function
  • Previous by thread: NSArrayController & image in column
  • Next by thread: Re: NSArrayController & image in column
  • Index(es):
    • Date
    • Thread