I am working on a project where I have created a .xib file and want to load the window created in the xib file.
I have tried the following code, but to no avail:
- (id) initWithWindowNibName: (NSString *) windowNibName
{
self = [ super initWithWindowNibName: windowNibName];
if ( self != nil )
{
[ self window ];
}
return self;
}
I am calling the initWithWindowNibName method hoping that it would load the window associated with the current controller. Basically, I am throwing darts in the dark!
I actually have very little idea about how to basically associate the created nib with the controller so that the above code actually loads the window. I have been able to associate various IBOutlets and IBActions but just not able to load the window.
Am I going the wrong path or is there specific method calls to load the window?
Edit: The [super initWithWindowNibName: windowNibName] call is to NSWindowController which is the super class of this controller class.
You call it as :
Then you need to show the window:
Or if you want to load it as sheet:
EDIT: