Re: Setting a subclass of NSButtonCell in code
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