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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to