Re: Cannot encode custom NSView [SOLVED]
Re: Cannot encode custom NSView [SOLVED]
- Subject: Re: Cannot encode custom NSView [SOLVED]
- From: Ricky Sharp <email@hidden>
- Date: Tue, 09 Nov 2004 10:31:05 -0600
On Tuesday, November 09, 2004, at 07:28AM, Ricky Sharp <email@hidden> wrote:
[original e-mail edited]
It was pointed out to me off-list that perhaps the problem I had was that there was no initWithFrame: method. This turned out to be exactly what I needed.
I only had to make two changes in IIGraphic.m:
>[IIGraphic.m]
>
>@implementation IIGraphic
>
>- (id)init
>{
> if (self = [super init])
> {
> mGraphicType = 0;
> mGraphicColor = [[NSColor blackColor] retain];
> }
>
> return self;
>}
(1) This init method became initWithFrame:. And of course my call to super became [super initWithFrame:frame];
>- (id)copyWithZone:(NSZone*)zone
>{
> IIGraphic* newCopy = [[IIGraphic alloc] init];
>
> [newCopy setGraphicType:[self graphicType]];
> [newCopy setGraphicColor:[self graphicColor]];
>
> return newCopy;
>}
(2) Rather than the first line calling init, this is now [[IIGraphic alloc] initWithFrame:[self frame]];
As I mentioned originally, it was most like something painfully obvious. I had been coding most of my widgets as derivatives from NSControl/NSCell, so had overlooked the necessity of providing initWithFrame when working with a direct NSView decendent.
Thanks to everyone who helped with this issue.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
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