Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Xcode decide which XIB to show first

Tags:

macos

cocoa

xib

When I create a new cocoa project in Xcode, it creates a MainMenu.xib file with a Window. I would like to separate the window into a MainWindow.xib and have that show up as the main window - how do I do that?

If I create a 'document' based application - I see two xibs (MainMenu.xib and MyDocument.xib) and I notice that MyDocument.xib gets displayed right away - but I don't understand where this is identified. There doesn't seem to be explicit code and I'm not sure where to look in the plists.

If I create a new Document, how can I make it the primary window that shows up when I start the app?

like image 291
Luther Baker Avatar asked Mar 08 '11 20:03

Luther Baker


1 Answers

in <YourProjectName>-Info.plist you'll find the key "Main nib file base name", with the value of the first xib to load usually "MainMenu".

Also you'll find "Document types" -> "Item 0" -> "Cocoa NSDocument Class" and there the value "MyDocument". In the class "MyDocument" there is a method - (NSString *)windowNibName. This return the name of the first xib to load.

like image 158
vikingosegundo Avatar answered Sep 20 '22 19:09

vikingosegundo