Re: NSView initWithFrame called twice
Re: NSView initWithFrame called twice
- Subject: Re: NSView initWithFrame called twice
- From: "Albert Russel" <email@hidden>
- Date: Mon, 12 Aug 2002 09:43:26 +0200
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.
>
>
On Sunday, August 11, 2002, at 02:20 PM, cocoa-dev-
>
email@hidden wrote:
>
>
> I have a NSView derived custom view within an NSScrollView. It has the
>
> following initialization method:
>
>
>
> - (id) initWithFrame:(NSRect) frameRect
>
>
>
> When my program starts the initWithFrame method gets called twice. I
>
> understand that when the nib file is unarchived one init
>
> message is sent to
>
> my custom view but where does the second message come from? Is
>
> it sent from
>
> the NSScrollView and if so how do I prevent this from happening.
>
>
>
--
>
Brian Webster
>
email@hidden
>
http://homepage.mac.com/bwebster
_______________________________________________
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.