What? No, that is not the idea. When an object is unarchived from a nib it is instantiated as part of the unarchiving process, and you're supposed to perform initialization in initWithCoder:, not allocation (that's why in Cocoa we separate the concepts of allocation and initialization). The code you have below completely negates the effect of having an object in a nib by creating a new object and returning that. Instead of returning a new button object, you should be performing initialization on the one you already have.

Luke

On Aug 15, 2009, at 7:42 AM, Chase Meadors wrote:

The idea is to do something like this in a custom class:

- (id)initWithCoder:(NSCoder *)coder {

        if (self = [super initWithCoder:coder]) {

                return [NSButton buttonWithType:UIButtonTypeRoundedRect];

        }

}

_______________________________________________

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