• 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: Checking facts on NSCell (e.g. in NSTableView)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking facts on NSCell (e.g. in NSTableView)


  • Subject: Re: Checking facts on NSCell (e.g. in NSTableView)
  • From: "Kyle Sluder" <email@hidden>
  • Date: Thu, 8 Jan 2009 04:20:05 -0500

On Thu, Jan 8, 2009 at 3:31 AM, Luke Evans <email@hidden> wrote:
> Am I wrong about this interpretation of what I'm reading?

Yes, take a look at -setObjectValue:.  This point confused me for
ages.  You can bind the cell's value to whatever object you like, and
in -setObjectValue: extract the relevant information into ivars for
later use.

> By way of further example, if you had a data model containing some objects
> that have, say, an NSColor property, and you want to paint a simple colour
> swatch in a custom cell, is there no simple way of binding the NSColor value
> to the cell and picking this up in the cell?  Perhaps one has to resort to
> subclassing the control somehow to get richer forms of cell instantiation if
> this is needed???

There's no NSColorWellCell, unfortunately, or else this would be
already done for you.  Instead, just subclass NSCell, override
-setObjectValue:, and implement -drawRect: appropriately.  Make sure
to call -[NSTableColumn setDataCell:].

More info can be had at this old page (Google cache because it's no
longer on kupuk.com):
http://74.125.45.132/search?q=cache:QhibCjcx2f0J:kupuk.com/2007/10/08/custom-nscells-with-nsmanagedobjects/+nscell+bindings

--Kyle Sluder
_______________________________________________

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

  • Follow-Ups:
    • Re: Checking facts on NSCell (e.g. in NSTableView)
      • From: Luke Evans <email@hidden>
References: 
 >Checking facts on NSCell (e.g. in NSTableView) (From: Luke Evans <email@hidden>)

  • Prev by Date: Re: Checking facts on NSCell (e.g. in NSTableView)
  • Next by Date: Accessing Customize Toolbar items created in nib file
  • Previous by thread: Re: Checking facts on NSCell (e.g. in NSTableView)
  • Next by thread: Re: Checking facts on NSCell (e.g. in NSTableView)
  • Index(es):
    • Date
    • Thread