• 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: Cannot encode custom NSView [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Cannot encode custom NSView (From: Ricky Sharp <email@hidden>)

  • Prev by Date: Problem with NSWindow WindowFrameAutosaveName
  • Next by Date: Re: NSView lockFockus assertion?
  • Previous by thread: Re: Cannot encode custom NSView
  • Next by thread: Digital Video Broadcast
  • Index(es):
    • Date
    • Thread