Loading multiple NIBs == multiple awakeFromNib calls
Loading multiple NIBs == multiple awakeFromNib calls
- Subject: Loading multiple NIBs == multiple awakeFromNib calls
- From: John Lombardo <email@hidden>
- Date: Wed, 22 Oct 2003 15:20:35 +0800
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.