I have downloaded an Xcode project that has three xibs (A.xib, B.xib, and C.xib). I noticed that:
- None of them is called “MainWindow.xib”.
- In the project summary the Main Interface value is set to MainWindow
- Main nib file base name is not set
- Main.c does not specify the app delegate either
int retVal = UIApplicationMain(argc, argv, nil, nil);
Still, when I build&run, the app loads A.xib.
How does the app decide what to load?
I am using Xcode 4 and I am targeting iOS 5.
Thank you.
You can set the
Main Interfacein the Summary tab of your app target.See this image:
EDIT: Or, as Alan wrote, you can set it in your info.plist file.
EDIT 2: Oh. I see what your problem is. You can use MainWindow as your main .xib file, but you have to edit which .xib is loaded in MainWindow. Open MainWindow.xib, and select the view controller that is used. If I’m right, its class is set to
A. If you want B.xib to be used, you have to change the class toB. You will also have to set the NIB being used for the view controller, in the Attribute Inspector.Set the class for the UIViewController being used in MainWindow.xib:
Set the NIB: