0
votes

I have created the tabview cocoa application and having xib file name "MainMenu.xib". also inserted a button in MainMenu.xib file. And now I created a window having xib filename(testwindow.xib). Now I want to when I clicked on button then the testwindow should be popup. I have tried like In Appdelegate.mm

-(IBAction)hellobtn:(id)sender
{
NSWindowController *hellocontroller = [[NSWindowController alloc] initWithWindowNibName:@"testwindow.xib"];
[hellocontroller showWindow:self];
NSLog(@"Windows=%@", [hellocontroller window]);

The code is compiled success. But when I clicked on button the following error generated in output windows:

[NSWindowController loadWindow]: failed to load window nib file 'testwindow.xib'.
windows(null) //NSLog output

Can any one please tell me how to launch the another window from appdelegate.mm file.

Thanks,

2

2 Answers

1
votes

When you load nib you should NOT put extension in the name.

Like so:

NSWindowController *hellocontroller = [[NSWindowController alloc] initWithWindowNibName:@"testwindow"];
0
votes

fixed,

I have defined the NSWindowController *hellocontroller; below implementation of main class;

and then on button action I wrote :

hellocontroller = [[NSWindowController alloc] initWithWindowNibName:@"testwindow"];
[hellocontroller showWindow:self]; //optional, without this line, it is also running.