pdenlinger
pdenlinger

Reputation: 3917

MainController.xib file required for every project?

Is a MainController.xib file required for every iOS project? Reason I ask is because I have started to work on some programs, and I noticed that with some of the defaults there is no MainController.xib file generated.

If it is not generated by the template, does this mean that I have to create one myself using "Add File?"

I have a vague recollection of reading somewhere that MainController.xib generated the first view when the program loads but am not sure if this is correct?

Thank you.

Upvotes: 0

Views: 123

Answers (2)

rob mayoff
rob mayoff

Reputation: 385890

It's not required. As far as I know, none of the templates in Xcode 4.2 and 4.3 create a MainController.xib.

Your app's Info.plist can contain the “Main nib file base name” key. The raw key is NSMainNibFile, and it also shows up on the app's Summary screen as the “Main Interface” combo box.

If this key has the value MainController, then you need to have a nib named MainController. The app will automatically load this when it is launched. You can set the value of the key to something else if you want to name your main nib something else. (I usually name mine MainInterface.)

If you don't include this key in your Info.plist, then the app won't automatically load a nib when it is launched.

Upvotes: 2

Mike D
Mike D

Reputation: 4946

That looks like a default name generated by XCode. Depending on the project template, whatever the the .xib file is named, you get a controller to go with it.

Upvotes: 0

Related Questions