application app launches are divided into two categories: 1. Storyboard 2. No storyboard Storyboard:In
the case of a storyboard
1. Execute the main function;
2. Execute the Uiapplicationmain function
* Create UIApplication objects;
* Create a uiapplication delegate object;
(Note: The third parameter of the Uiapplicationmain function is the name of the uiapplication, and if specified as nil, it defaults to UIApplication, Uiapplicationmain The fourth parameter of the function is UIApplication's proxy )
3. Open a main run cycle to ensure that the application does not exit
4. Obtain Main.storyboard file name according to Info.plist, load main.storyboard (with storyboard situation)
* Create UIWindow;
* Create and set UIWindow Rootviewcontroller
* Display window
Without the storyboard case:
1.main function;
2.UIApplicationMain
* Create UIApplication objects;
* Create a UIApplication delegate object
(Note: The third parameter of the Uiapplicationmain function is the name of the uiapplication, and if it is specified as nil, it defaults to UIApplication, and the fourth parameter of the Uiapplicationmain function is UIApplication's agent )
3. Open a main run cycle to ensure that the application does not exit
3.delegate object starts processing (listening) for system events (no storyboard)
* When the program starts, it will call the agent's application:didfinishlaunchingwithoptions: method;* Create UIWindow in application:didfinishlaunchingwithoptions: method;* Create and set UIWindow Rootviewcontroller;
* display window;
life cycle of the application:
-(BOOL) Application: (uiapplication) Application willfinishlaunchingwithoptions: (nsdictionary) launchOptions Tells the agent that the process has started but has not yet entered a state save
-(BOOL) Application: (uiapplication) Application didfinishlaunchingwithoptions: (nsdictionary) launchOptions Tells the agent to start the basic Completion program ready to start running
-(void) Applicationwillresignactive: (uiapplication *) Application when the application is going into an inactive state, during which time the application does not receive messages or events, such as coming to the phone
-(void) Applicationdidbecomeactive: (uiapplication *) application when the application executes in the active state, this is exactly the opposite of the method above
-(void) Applicationdidenterbackground: (uiapplication *) application called when the program is pushed to the background. So to set the background to continue running, you can set it in this function
-(void) Applicationwillenterforeground: (uiapplication *) application called when the program is going back to the foreground from the background, which is exactly the opposite of the method above.
-(void) Applicationwillterminate: (uiapplication *) application when the program is about to exit is called, usually to save the data and some cleanup work before exiting.
Application App startup process