Re: Loading multiple NIBs == multiple awakeFromNib calls
Re: Loading multiple NIBs == multiple awakeFromNib calls
- Subject: Re: Loading multiple NIBs == multiple awakeFromNib calls
- From: John Lombardo <email@hidden>
- Date: Wed, 22 Oct 2003 16:18:29 +0800
Meh, I forgot to check the mailing list. Looks like testing to see if the
first awakeFromNib call has done something already seems to be the accepted
technique.
John
On 22/10/03 3:20 PM, "John Lombardo" <email@hidden> wrote:
>
What's the best way to prevent awakeFromNib being called more than once when
>
loading subsequent NIB files?
>
>
My main class includes in its init...
>
>
// Contains the main window
>
if (![NSBundle loadNibNamed:@"KKGenericWindow" owner:self])
>
NSLog(@"Error loading Nib named:%@!", @"KKGenericWindow");
>
>
// Contains specific elements for each subclass
>
if (![NSBundle loadNibNamed:[self className] owner:self])
>
NSLog(@"Error loading Nib named:%@!", [self className]);
>
>
As the owner for both is self, awakeFromNib gets called twice. Means of
>
working around this that have occurred to me include a flag that gets set
>
once the method has been called the first time. Is there a better way to
>
do/avoid this?
>
>
Cheers,
>
John
>
_______________________________________________
>
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.
_______________________________________________
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.