How does Xcode load the main storyboard?

后端 未结 7 1214
遥遥无期
遥遥无期 2020-12-13 08:37

When I create a new single view application in Xcode 4.6 using storyboard, we can see that the main function creates a new application using the application delegate like th

7条回答
  •  失恋的感觉
    2020-12-13 08:38

    Give a look to the UIApplicationMain discussion:

    Discussion
    This function instantiates the application object from the principal class and instantiates the delegate (if any) from the given class and sets the delegate for the application. It also sets up the main event loop, including the application’s run loop, and begins processing events. If the application’s Info.plist file specifies a main nib file to be loaded, by including the NSMainNibFile key and a valid nib file name for the value, this function loads that nib file.

    When UIApplicationMain gets called, a plist file containing all the application info is loaded:

    enter image description here

    That's how it "understands" that the xib/storyboard file needs to get loaded.

提交回复
热议问题