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 rea开发者_开发技巧d 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.
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.
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.
精彩评论