I\'m trying to open a window using a NSWindowController in my app delegate. I created a basic NSWindowController with an associated NIB and try to show the window that way:<
You need to add a property to your app delegate (or some other object that's going to stick around for the lifetime of your app) that retains theWindowConroller. For example:
@interface MyAppDelegate : NSObject
@property (strong, nonatomic) MyWindowController * windowController;
@end
Then set this property when you initialize the window controller.
@implementation MyAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Show the main window from a separate nib
self.windowController = [[MyWindowController alloc] initWithWindowNibName:@"MyWindowController"];
[theWindowController showWindow:self];
}
@end