Reputation: 21
I have made a window xib and cocoa class file (nswindowcontroller) and need to show the window from xib with an button action from main window.
Upvotes: 1
Views: 1286
Reputation: 1145
In your main NSWindowController:
In the interface:
@property (nonatomic, strong) CustomWindowController *windowController;
In the implementation:
- (IBAction)didPressOpenWindowButton:(id)sender {
CustomWindowController *wc = [[CustomWindowController alloc] init];
[wc showWindow:nil];
[wc.window makeKeyAndOrderFront:nil];
_windowController = wc;
}
Connect your IBAction to your NSButton in the main window.
Upvotes: 0