<span id="Label3"></p><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;"><strong>first, The principle of program start</strong></span></span><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">1.1, Ma</span></span>The in function executes a uiapplicationmain function Uiapplicationmain (int argc, char *argv[], nsstring *principalclassname, NSString * delegateclassname);<p><p><span style="font-family: ‘Courier New‘;">1.2, argc, argv: Direct transmission to Uiapplicationmain for related processing can be</span></p></p><p><p><span style="font-family: ‘Courier New‘;">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</span></p></p><p><p><span style="font-family: ‘Courier New‘;">delegateclassname: Specifies the Application's proxy class, which must comply with the Uiapplicationdelegate protocol</span></p></p><p><p><span style="font-family: ‘Courier New‘;">1.3. The Uiapplicationmain function creates a UIApplication object based on Principalclassname and creates a delegate object based on Delegateclassname. and assigns the delegate object to the delegate property in the UIApplication object</span></p></p><p><p><span style="font-family: ‘Courier New‘;">1.4. then the main runloop (event LOOP) of the application is established, and the event is processed (first call delegate to Application:didfinishlaunchingwithoptions after the program is Finished)</span></p></p><p><p>1.5. The Uiapplicationmain function returns when the program exits normally</p></p><p><p></p></p><p><p></p></p><p><p></p></p><p><p></p></p><pre><pre><span style="font-family: ‘Courier New‘;">#import <UIKit/UIKit.h> #import "AppDelegate.h" int main (int argc, char * argv[]) { @autoreleasepool { return uiapplicationmain (argc, argv, nil, nsstringfromclass ([appdelegate class])); return uiapplicationmain (argc, argv, @ "uiapplication", nsstringfromclass ([appdelegate class]);/* argc: The number of parameters that the system or user passed in argv: the actual parameter that the system or user passed in 1. Creates a UIApplication object based on the third parameter passed in 2. Based on the fourth incoming agent that generated the creation of the UIApplication object 3. Set the proxy object that you just created for uiapplication 4. Open an event loop */return uiapplicationmain (argc, argv, @ "uiapplication", @ "appdelegate");} }</span> <strong style="font-family: verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.5;"><span style="font-family: ‘Courier New‘;"> </span></strong></pre></pre><strong><strong><span style="font-family: ‘Courier New‘;"> </span></strong></strong><strong><strong><span style="font-family: ‘Courier New‘;">second, The complete process of program start</span></strong></strong><p><p></p></p><p><p><span style="font-family: ‘Courier New‘;">Starting with the main file, there are two types of program Initiation: 1. Storyboard 2. No Storyboard.</span></p></p><p><p><span style="font-family: ‘Courier New‘;">(a) in case of storyboard:<br>1.main function</span></p></p><p><p><span style="font-family: ‘Courier New‘;">2.UIApplicationMain</span></p></p><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-create UIApplication Object</span></span><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-create a uiapplication delegate object</span></span><p><p><span style="font-family: ‘Courier New‘;">3. According to Info.plist to obtain the most important storyboard file name, load the main storyboard (with Storyboard)</span></p></p><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-create UIWindow</span></span><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-create and set Uiwindow's Rootviewcontroller</span></span><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-display window</span></span><p><p><span style="font-family: ‘Courier New‘;">(ii) in the absence of storyboard:<br>1.main function</span></p></p><p><p><span style="font-family: ‘Courier New‘;">2.UIApplicationMain</span></p></p><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-create UIApplication Object</span></span><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-create a uiapplication delegate object</span></span><p><p><span style="font-family: ‘Courier New‘;">3.delegate object starts processing (listening) system events (no Storyboard)</span></p></p><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-the Agent's application:didfinishlaunchingwithoptions is invoked when the program is Started: method</span></span><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-create UIWindow in Application:didfinishlaunchingwithoptions:</span></span><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-create and set Uiwindow's Rootviewcontroller</span></span><span style="font-family: ‘Courier New‘;"><span style="font-family: ‘Courier New‘;">-display window</span></span><p><p></p></p><p><p>App startup principle and startup process</p></p></span>
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