I'm building a framework in Xcode, and I need to display a window when a function is called. How do I get my framework to display a window that I build in Interface Builder? Step by step instructions would be greatly appreciated!
Thanks, Chetan
I'm building a framework in Xcode, and I need to display a window when a function is called. How do I get my framework to display a window that I build in Interface Builder? Step by step instructions would be greatly appreciated!
Thanks, Chetan
Use an NSWindowController
as the window's File's Owner, and then just call [myWindowController showWindow:nil]
.
You'd call it like this:
MyWindowController* controller = [[MyWindowController alloc]
initWithWindowNibName:@"Foo"];
[controller showWindow:nil];
Where Foo is the name of the nib file, and MyWindowController
is a subclass of NSWindowController that you set to be the owner of the nib file.
In this case, it's important to subclass NSWindowController because it will automatically search for the nib file the bundle that the class lives in.