When creating a new iOs project some code is auto generated which includes “mainWindow.xib” that Also contains the app delegate reference.
I am new to iOs development hence have a basic question :
- From the main method whe the applicaion loop starts how and when does the mainWindow.xib file comes into play ? How does it get control ?
- Is the file name “mainWindow.xib” reserved that runtimes/compiler picks up on automatically ?
Thanks
Dc
In Xcode, if you select the Project -> Target and then look at the “Info” tab, you can change the primary nib file there.
Or you can do this by selected and editing your “XXX-Info.plist” directly. Both are the same thing.
So basically when UIApplicationMain() runs, it will look at this XXX-Info.plist and then load whichever primary nib is indicated there by the key “NSMainNibFile”
By default the value for this key is “MainWindow”. But you can change it to whatever you like.
(BTW, the normal case is that UIApplicationMain will create an instance of UIApplication and then load the “main nib” with that UIApplication instance as “file’s owner”. And typically you put your delegate instance in that nib. You can change this behavior if you want by passing different parameters to UIApplicationMain())
Hope that helps.