I'm facing this strange problem and I'm not sure where I'm going wrong.
Situation:
I have a MainWindowController class which will load the correct nibs to be displayed. I created an object and changed it to MainWindowController class in the IB and put it with "MainWindowView" nib.
So basically the nib "MainWindowView" has the custom view and a few buttons on the side so that the user can select which view to load and it will load the other respective nib. I've hidden the mainmenu during launch in the IB so it only loads the MainWindowView with the other nib files.
While debugging however, when I put a NSLog on MainWindowController's awakeFromNib, I saw that in the console it was being called twice.
in my project, I have a startupController class together with MainMenu.xib with the following code.
startUpController.h:
#import <Cocoa/Cocoa.h>
#import "MainWindowController.h"
@interface startupController : NSObject {
MainWindowController *myWindowController;
}
@end
startUpController.m:
#import "startupController.h"
@implementation startupController
-(void)awakeFromNib {
[super init];
if(myWindowController == nil)
myWindowController = [[MainWindowController alloc] initWithWindowNibName:@"MainWindowView"];
[myWindowController showWindow:self];
}
@end
any help is appreciated. thanks.