iOS-developed iOS program startup process

Source: Internet
Author: User

The complete process for program startup:

( 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 get the most important Storyboard the file name , load the most important Storyboard ( with Storyboard)

* Create UIWindow

* Create and set UIWindow Rootviewcontroller

* Display window

( 4 ) Uiapplicationmain

A uiapplicationmain function is executed in the main function:

int uiapplicationmain (int argc, char *argv[], NSString

*principalclassname, NSString *delegateclassname);

The meaning of each parameter:

argc , argv: Transfer directly to Uiapplicationmain for related processing.

principalclassname: Specifies the application class name (symbol of the app), which must be uiapplication (or subclass). If nil, the UIApplication class is used as the default value.

delegateclassname: Specifies the application's proxy class, which must adhere to 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 (event loop) is then created, and the event is processed (the application:didfinishlaunchingwithoptions of the delegate object is called first after the program is finished).

The Uiapplicationmain function returns when the program exits normally.

iOS-developed iOS program startup process

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.