• 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: Best place to set custom NSButtonCell?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best place to set custom NSButtonCell?


  • Subject: Re: Best place to set custom NSButtonCell?
  • From: Camillo Lugaresi <email@hidden>
  • Date: Wed, 28 Dec 2005 16:26:59 +0100

On 28/dic/05, at 16:13, August Trometer wrote:

As far as I can tell, NSButton doesn't respond to init.

It _does_ respond to initWithCoder:, but setCellClass is a class method and won't work inside initWithCoder:. Same for awakeFromNib.

Oops, I didn't even notice that setCellClass is a class method... sorry. But the documentation has this to say about setCellClass:

Discussion
If you have a custom cell subclass that you would like to substitute for the class of a cell object in a nib file, you should set the cell class in awakeFromNib (NSNibAwaking protocol). You cannot change the class programmatically after the cell object has been unarchived from the nib and instantiated, which occurs immediately after awakeFromNib returns. If you are going to be using your custom cell frequently, consider creating your own Interface Builder palette containing the cell.


So it seems that calling it from awakeFromNib is supposed to work.

Camillo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Best place to set custom NSButtonCell? (From: August Trometer <email@hidden>)
 >Re: Best place to set custom NSButtonCell? (From: Camillo Lugaresi <email@hidden>)
 >Re: Best place to set custom NSButtonCell? (From: August Trometer <email@hidden>)

  • Prev by Date: Re: Best place to set custom NSButtonCell?
  • Next by Date: Re: Best place to set custom NSButtonCell?
  • Previous by thread: Re: Best place to set custom NSButtonCell?
  • Next by thread: Re: Best place to set custom NSButtonCell?
  • Index(es):
    • Date
    • Thread