• 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: Setting a subclass of NSButtonCell in code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting a subclass of NSButtonCell in code


  • Subject: Re: Setting a subclass of NSButtonCell in code
  • From: Lee Ann Rucker <email@hidden>
  • Date: Thu, 15 Apr 2010 11:25:29 -0700


On Apr 15, 2010, at 2:14 AM, Arun wrote:

Hi All,

I have subclassed NSButtonCell and overridden some methods.
I know that we need to set the name of the subclass in the IB to get the
effects of the subclass.
Instead of setting it in the IB, is it possible to set the class in the code
itself? if yes how can we do this.

Not really. Before IB allowed setting the cell's class, you'd have to have a matching subclass of NSButton and do something like this (pseudocode, from memory, because we've deleted all the code that did this):


NSButtonCell *oldCell = [self cell];
MyButtonCell newCell = [[MyButtonCell alloc] init];
[newCell setFoo:[oldCell foo]];
[newCell setBar:[oldCell bar]];

.....
[self setCell:newCell];

You can see why we like using the new IB better.

_______________________________________________

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: 
 >Setting a subclass of NSButtonCell in code (From: Arun <email@hidden>)

  • Prev by Date: Re: Setting front window when launched from another application
  • Next by Date: Re: NSNumberFormatter not working for me ?
  • Previous by thread: Re: Setting a subclass of NSButtonCell in code
  • Next by thread: Display AppleScript dictionary browser
  • Index(es):
    • Date
    • Thread