I have a simple Cocoa app. It has two windows, each in a separate xib file:
- MainMenu.xib
- SecondaryWindow.xib
I have an AppDelegate class, which has a reference to the window in MainMenu.xib. I'm trying to make it have a reference to the window in SecondaryWindow.xib. I'm confused about how to do this. I have made an outlet, as such:
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSWindow *secondaryWindow;
@end
Here's the implementation:
@implementation AppDelegate
@synthesize window = _window;
@synthesize secondaryWindow = _secondaryWindow;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[NSBundle loadNibNamed:@"SecondaryWindow" owner:self];
NSLog(@"_window = %@", _window);
NSLog(@"_secondaryWindow = %@", _secondaryWindow);
}
@end
_secondaryWindow is always (null)
I've add an outlet from in SecondaryWindow.xib connection the second window to the outlet in AppDelegate. What else do I need to do in SecondaryWindow.xib to make the connection complete?
EDIT: added [NSBundle loadNibNamed...]