0

I create a cocoa application on OSX 10.8. I create a windows derived from NSWindowController and also create a .xib file for this window, I want to show this window when application start, so I add the following in the applicationDidFinishLaunching function

wndAgreement = [[AgreementWindow alloc] initWithWindowNibName:@"AgreementWindow"];
[wndAgreement showWindow:self]; 

But I still see the application's main window showing. Basically, the main window is behind my window. How to make the main window not show at all and only showing my window? The reason I am doing this is because I am building a wizard application, so click next on one window will open another window and close the current window.

JennyS
  • 119
  • 9

2 Answers2

1

The main window is probably showing because it's in the main menu NIB and has Visible At Launch enabled. "Visible At Launch" really means "visible when the NIB is loaded".

The quickest fix is to turn off Visible At Launch for that window. Better would be to remove that window from that NIB. Although it's the default behavior you get from Apple's project templates, it's a bad idea of have a window in your main menu NIB. They should all be done like your new window, with a separate NIB.

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154
0

Go to the "Supporting Files" Folder of your project and click on the file that ends in "info.plist." Under "Main nib file base name," you will likely see "MainMenu." Delete this and enter the name of the window you want to show at launch.

Zag
  • 819
  • 1
  • 8
  • 12
  • No. As I said, you should not have a window in your main NIB. Also, if he switches the main NIB, he will lose his app's main menu. – Ken Thomases Apr 13 '14 at 16:38