Uiapplicationmain
A uiapplicationmain function is executed in the main function.
int uiapplicationmain (int argc, char *argv[], nsstring *principalclassname, NSString *delegateclassname);
ARGC, argv: direct transfer to Uiapplicationmain for related processing can be
Principalclassname: Specifies the application class name (symbol of the app), which must be uiapplication (or subclass). If nil, use the UIApplication class as the default value
Delegateclassname: Specifies the application's proxy class, which must comply with the Uiapplicationdelegate protocol
The Uiapplicationmain function creates a UIApplication object based on Principalclassname and creates a delegate object from Delegateclassname. and assigns the delegate object to the delegate property in the UIApplication object
The application's main Runloop (the event loop) is then created, and the event is processed (the application:didfinishlaunchingwithoptions of the delegate object is called first after the program is completed: method)
The Uiapplicationmain function returns when the program exits normally
The program starts the complete process:
1.main function
2.UIApplicationMain
* Create UIApplication objects
* Create a UIApplication delegate object
3.delegate object starts processing (listening) system events ( no storyboard)
* When the program is started, the agent's application:didfinishlaunchingwithoptions is called: method
* Create UIWindow in application:didfinishlaunchingwithoptions:
* Create and set UIWindow Rootviewcontroller
* Display window
3. According to Info.plist to obtain the most important storyboard file name, load the main storyboard ( with storyboard)
-Create UIWindow
-Create and set UIWindow Rootviewcontroller (the controller that the arrow points to in the storyboard)
-Display window
Storyboard: Official document: Iosx/uikit/viewcontroller P C for iOS
The Main Storyboard initializes Your App ' s User Interface
The main storyboard is defined in the app's Information property list file. If A main storyboard is declared in this file and then when your app launches, IOS performs the following steps:
- It instantiates a window for you.
- It loads the main storyboard and instantiates its initial view controller.
- It assigns the new view Controller to the window's Rootviewcontroller property and then makes the window visible on the SC Reen.
Translation:
-
The main story panel initializes the application's user interface
The Information property list file for the application that is defined in the main story panel. If a major story is declared in this Info.plist file (main), then when your app launches, iOS performs the following steps:
1. It instantiates a window for you.
2. It loads (arrows pointing) the main story panel and instantiates it as the initial view controller.
3. It gives the new View Controller window Rootviewcontroller and will display the contents of this window on the screen.
A program can display something because it has windows.
Summary: First start the program to load Main.storyboard
Start creating Windows when loading is complete
and create the arrow to point to the controller and set it to the window root controller and show the window to the controller root controller is also displayed on the screen
iOS program start-up process-uiwindow