• 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: NSView initWithFrame called twice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView initWithFrame called twice


  • Subject: Re: NSView initWithFrame called twice
  • From: "Albert Russel" <email@hidden>
  • Date: Mon, 12 Aug 2002 15:01:03 +0200

I forgot to return self but if I do that the init method still is called
twice.

- (id) initWithFrame: (NSRect) rect
{
[super initWithFrame: rect];
NSLog(@"init gets called\n");
return self;
}


> I did look at the stack trace before I posted my question but it is the
same
> for both calls:
>
> 0 -[MyView initWithFrame:]
> 1 -[NSCustomView nibInstantiate:]
> 2 -[NSCustomView nibInstantiate:]
> 3 -[NSIBObjectData instantiateObject:]
> 4 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:]
> 5 -[NSRTFReader dealloc]
> 6 +[NSBundle(NSNibLoading)_loadNibFile:name Table:withZone:ownerBur....
> 7 +[NSBundle(NSNibLoading)_loadNibFile:externalName Table:withZone:]
> 8 +[NSBundle(NSNibLoading) LoadNibNamed:owner:]
> 9 NSApplicationMain
> 10 main
> 11 _start
> 12 start
>
> The value for self is different for the 2 calls though and the value of
self
> in the second call is shown in red instead of black. Why this red color
and
> does this mean there are 2 MyViews in the nib file? I can only see 1
MyView
> in InterfaceBuilder.
>
> I stripped the init to this:
>
> - (id) initWithFrame: (NSRect) rect
> {
> [super initWithFrame: rect];
> NSLog(@"init gets called\n");
> }
>
> > Set a breakpoint in the initWithFrame: method and run it using
> > the debugger. This will let you see the stack trace where each
> > call is made. Also, check to see if the method is being called
> > twice on the same object, or if there are actually two different
> > objects each being sent the message once.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: NSView initWithFrame called twice (From: "Albert Russel" <email@hidden>)

  • Prev by Date: Re: (no subject)
  • Next by Date: Re: full screen
  • Previous by thread: Re: NSView initWithFrame called twice
  • Next by thread: Re: NSView initWithFrame called twice
  • Index(es):
    • Date
    • Thread