Application App startup process

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.