achiral
achiral

Reputation: 601

Objective-C - What to do with MainWindow.xib?

So, after creating a new project in Xcode, I'm presented with an interface file, an implementation file and a MainWindow.xib file. I've read that view controllers are necessary for every "screenful" displayed, so my question is what is the purpose of the MainWindow.xib file?

At the moment it is the window that loads when you start the program, but if I set up a view controller and its associated .xib file with a screenful to display when the application starts, won't MainWindow.xib just be a pointless file?

(I'm very new to this and am trying to understand the basics).

Thanks for any help.

Upvotes: 0

Views: 263

Answers (2)

Suhail Patel
Suhail Patel

Reputation: 13694

The MainWindow.xib file contains the actual Window (which the System needs) in which your View Controllers are added on top (like Layers on top of each other, the Window is the Bottom canvas).

This window is specified as an IBOutlet to your main delegate. You can remove the MainWindow.xib file after rejigging a few things around but it's harmless to leave it in there.

Upvotes: 3

Macmade
Macmade

Reputation: 53970

Basically, a Coca application needs a main XIB file (it's not a requirement, just a common practice).

It may not contain windows, especially if you are using view controllers to load separate XIB file.

In such a case, the main XIB file is usually responsible to define the application's menu, with their actions.

Upvotes: 2

Related Questions