<span id="Label3"></p><strong><strong>first,<strong>uiapplication</strong> </strong></strong>1. Brief Introduction<p style="margin-left:60px"><p style="margin-left:60px"><span>(1) uiapplication</span> <span>An object is a symbol of an application, and a UIApplication object represents an Application. </span></p></p><p style="margin-left:60px"><p style="margin-left:60px">(2) each application has its own uiapplication object, and is a singleton, if you try to create a new UIApplication object in the program, then the error prompt.</p></p><p style="margin-left:60px"><p style="margin-left:60px">(3) this singleton object can be obtained by [uiapplicationsharedapplication]</p></p><p style="margin-left:60px"><p style="margin-left:60px">(4) an iOS program is created after the first object is the UIApplication object, and only one (through the code to get two uiapplication objects, the print address can see the address is the same).</p></p><p style="margin-left:60px"><p style="margin-left:60px">(5) use the UIApplication object to perform some application-level operations</p></p><p style="margin-left:30px"><p style="margin-left:30px">2. Application-level Operation Examples:</p></p><p style="margin-left:90px"><p style="margin-left:90px"><span>1) set the application icon in the upper right corner of the red reminder number (such as QQ message, the icon will show a new message, such as Three-way bar. )</span></p></p><p style="margin-left:120px"><p style="margin-left:120px"><span>@property</span> <span>(</span><span>nonatomic</span><span>)</span> <span>Nsinteger</span> <span>applicationiconbadgenumber;</span></p></p><p style="margin-left:120px"><p style="margin-left:120px"><span>code Implementation and Effects:</span></p></p><span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span><pre>- (<span style="color:#0000ff"><span style="color:#0000ff">void</span></span><span style="color:#000000"><span style="color:#000000">) Viewdidload{[super viewdidload]; </span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">Create and add a button</span></span>UIButton *btn=[[uibutton Alloc]initwithframe:cgrectmake (<span style="color:#800080"><span style="color:#800080"></span> -</span>,<span style="color:#800080"><span style="color:#800080"></span> -</span>,<span style="color:#800080"><span style="color:#800080"></span> -</span>,<span style="color:#800080"><span style="color:#800080"></span> -</span><span style="color:#000000"><span style="color:#000000">)]; [BTN settitle:</span></span><span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">Button</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#000000"><span style="color:#000000">forstate:uicontrolstatenormal]; [BTN Setbackgroundcolor:[uicolor browncolor]; [BTN addtarget:self action: @selector (onClick) forcontrolevents:uicontroleventtouchupinside]; [self.view addsubview:btn];}</span></span>-(<span style="color:#0000ff"><span style="color:#0000ff">void</span></span><span style="color:#000000"><span style="color:#000000">) Onclick{NSLog (</span></span><span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">button click event</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#000000"><span style="color:#000000">); </span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">error, There can be only one unique UIApplication object that can no longer be created</span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">uiapplication *app=[[uiapplication alloc]init]; </span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">get the UIApplication object for the program by Sharedapplication</span></span>UIApplication *app=<span style="color:#000000"><span style="color:#000000">[uiapplication sharedapplication]; <span style="background-color:#33cccc">App.applicationiconbadgenumber</span> </span></span><span style="background-color:#33cccc"><span style="background-color:#33cccc">=<span style="color:#800080">123</span> </span></span><span style="color:#000000"><span style="color:#000000"><span style="background-color:#33cccc">;</span>}</span></span></pre><span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span><p style="margin-left:150px"><p style="margin-left:150px"></p></p><p style="margin-left:90px"><p style="margin-left:90px"><span>2) set the visibility of the networking indicator</span></p></p><p style="margin-left:120px"><p style="margin-left:120px"><span>@property</span> <span>(</span><span>nonatomic</span><span>,</span><span>getter</span><span>=isnetworkactivityindicatorvisible)</span> <span>BOOL</span> <span>networkactivityindicatorvisible;</span></p></p><p style="margin-left:120px"><p style="margin-left:120px"><span>Code and Effects:</span></p></p><pre><pre> <span style="color:#008000">//</span> <span style="color:#008000">set up an Indicator's networked animation</span> app.networkactivityindicatorvisible=yes;</pre></pre><p style="margin-left:120px"><p style="margin-left:120px"></p></p><p style="margin-left:90px"><p style="margin-left:90px">3) Manage Status bar</p></p><p style="margin-left:120px"><p style="margin-left:120px"><span>from</span> <span>iOS7</span> <span>at the beginning, the system provides</span> <span>2</span> <span>How to manage the status bar</span></p></p><p style="margin-left:120px"><p style="margin-left:120px"><span>A. by</span> <span>Uiviewcontroller</span> <span>Management (each of</span> <span>Uiviewcontroller</span> <span>can have their own different status bar).</span></p></p><p style="margin-left:150px"><p style="margin-left:150px"><span>In iOS7, by default, the status bar is managed by uiviewcontroller, and Uiviewcontroller can easily manage the visibility and style of the status bar by implementing the following methods</span></p></p><p style="margin-left:150px"><p style="margin-left:150px">The style of the status Bar-(uistatusbarstyle) preferredstatusbarstyle;</p></p><p style="margin-left:150px"><p style="margin-left:150px">Visibility of the status Bar-(BOOL) prefersstatusbarhidden;</p></p><span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span><pre><pre><span style="color:#0000ff">#pragma</span> Mark-set The style of the status bar-<span style="color:#000000">(uistatusbarstyle ) preferredstatusbarstyle{</span><span style="color:#008000">//</span> <span style="color:#008000">set to White </span> <span style="color:#008000">//</span> <span style="color:#008000">return uistatusbarstylelightcontent; </span> <span style="color:#008000">//</span> <span style="color:#008000">default is black</span> <span style="color:#0000ff">return</span> <span style="color:#000000">uistatusbarstyledefault;}</span> <span style="color:#0000ff">#pragma</span> mark-set whether the status bar is hidden (no)-<span style="color:#000000">(BOOL ) prefersstatusbarhidden{</span><span style="color:#0000ff">return</span> <span style="color:#000000"> NO;</span></pre></pre><span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span><p style="margin-left:120px"><p style="margin-left:120px"><span>B. by</span> <span>uiapplication</span> <span>Management (the Status bar of an application is managed uniformly by It)</span></p></p><p style="margin-left:150px"><p style="margin-left:150px"><span>If you want to use</span> <span>uiapplication</span> <span>to manage the status bar, you first have to modify the Info.plist settings</span></p></p><p style="margin-left:150px"><p style="margin-left:150px"></p></p><p style="margin-left:150px"><p style="margin-left:150px">Code:</p></p><span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span><pre> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">get the UIApplication object for the program by Sharedapplication</span></span>UIApplication *app=<span style="color:#000000"><span style="color:#000000">[uiapplication sharedapplication]; App.applicationiconbadgenumber</span></span>=<span style="color:#800080"><span style="color:#800080">123</span></span><span style="color:#000000"><span style="color:#000000">; </span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">set up an Indicator's networked animation</span></span>app.networkactivityindicatorvisible=<span style="color:#000000"><span style="color:#000000">YES; </span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">set the style of the status bar</span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">app.statusbarstyle=uistatusbarstyledefault;</span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">default (black)</span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">set to white + animated effect</span></span><span style="color:#000000"><span style="color:#000000">[app setstatusbarstyle:uistatusbarstylelightcontent animated:yes]; </span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">set whether the status bar is hidden</span></span>app.statusbarhidden=<span style="color:#000000"><span style="color:#000000">YES; </span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">sets whether the status bar hides + animated effects</span></span>[app Setstatusbarhidden:yes withanimation:uistatusbaranimationfade];</pre><span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span><p style="margin-left:120px"><p style="margin-left:120px"><span>C. <span style="background-color:#ffcc00">supplementary</span></span></p></p>Since both can be managed on the status bar, when should you use it? If the style of the status bar is set only once, use UIApplication to manage it, and if the status bar is hidden, the style is different then it is managed with the Controller. UIApplication to manage has additional benefits that can provide animation effects.<p style="margin-left:60px"><p style="margin-left:60px">4) OpenURL: method</p></p><p style="margin-left:90px"><p style="margin-left:90px"><span>UIApplication has a very powerful openurl: method</span></p></p><p style="margin-left:120px"><p style="margin-left:120px"><span>-(</span><span>BOOL</span><span>) openURL: (</span> <span>Nsurl</span> <span>*) url;</span></p></p><p style="margin-left:90px"><p style="margin-left:90px"><span>openURL:</span> <span>some of the functions of the method are</span></p></p><p style="margin-left:150px"><p style="margin-left:150px"><span>Call</span> UIApplication *app = [uiapplicationsharedapplication]; [app openurl:[nsurlurlwithstring:@ "tel://10086"];</p></p><p style="margin-left:150px"><p style="margin-left:150px"><span>Send SMS</span> [app openurl:[nsurlurlwithstring:@ "sms://10086"];</p></p><p style="margin-left:150px"><p style="margin-left:150px"><span>Send E-mail</span> [app openurl:[nsurlurlwithstring:@ "mailto://[email protected]"];</p></p><p style="margin-left:150px"><p style="margin-left:150px"><span>open a Web resource</span> [app openurl:[nsurlurlwithstring:@ "http://ios.itcast.cn"];</p></p><p style="margin-left:150px"><p style="margin-left:150px"><span>Open Other</span> <span>app</span> <span>program </span>OpenURL method, You can open other Apps.</p></p><span style="background-color:#ffcc00"><span style="background-color:#ffcc00">URL Additions</span></span>: URL: a Uniform Resource locator that is used to uniquely represent a resource. URL format: Protocol header://host address/resource Path network resources: http/ftp and so on to represent the address of Baidu on a picture http://www.baidu.com/images/20140603/abc.png local resources: file:///users/ Apple/desktop/abc.png (host Address Omitted)<strong><strong>second,<strong>uiapplication Delegate</strong> </strong></strong><p style="margin-left:30px"><p style="margin-left:30px"><span>1. Brief description</span></p></p><p style="margin-left:60px"><p style="margin-left:60px"><span>all mobile operating systems have a fatal disadvantage:</span> <span>app</span> <span>It is very easy to be disturbed. For example, a call or lock screen will cause</span> the <span>app</span> to <span>go backstage or even be terminated. </span></p></p><p style="margin-left:60px"><p style="margin-left:60px">There are a number of other similar situations that can cause the app to be disturbed, causing some system events when the app is disturbed, and UIApplication notifies its delegate object, allowing delegate agents to handle these system Events.</p></p>Function: when interrupted, notifies the agent to enter the Background.<p><p><span>each time a new project is completed, there is a</span> <span>"appdelegate"</span> <span>the class of words, it is</span> <span>uiapplication</span> <span>the agent,</span> Njappdelegate has complied with the Uiapplicationdelegate protocol by default and is already a proxy for Uiapplication.</p></p><p style="margin-left:30px"><p style="margin-left:30px"></p></p>2. Proxy Methods<span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span><pre><span style="color:#008080"><span style="color:#008080">1</span></span> <span style="color:#0000ff"><span style="color:#0000ff">#import</span></span> <span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#800000"><span style="color:#800000">YYAppDelegate.h</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#008080"><span style="color:#008080">2</span></span> <span style="color:#008080"><span style="color:#008080">3</span></span> <span style="color:#0000ff"><span style="color:#0000ff">@implementation</span></span><span style="color:#000000"><span style="color:#000000">yyappdelegate</span></span><span style="color:#008080"><span style="color:#008080">4</span></span> <span style="color:#008080"><span style="color:#008080">5</span></span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">called when the application is finished (automatically called by the System)</span></span><span style="color:#008080"><span style="color:#008080">6</span></span>-(BOOL) application: (uiapplication *) application didfinishlaunchingwithoptions: (nsdictionary *<span style="color:#000000"><span style="color:#000000">) Launchoptions</span></span><span style="color:#008080"><span style="color:#008080">7</span></span> <span style="color:#000000"><span style="color:#000000">{</span></span><span style="color:#008080"><span style="color:#008080">8</span></span>NSLog (<span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">didfinishlaunchingwithoptions</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#000000"><span style="color:#000000">);</span></span><span style="color:#008080"><span style="color:#008080">9</span></span> <span style="color:#0000ff"><span style="color:#0000ff">return</span></span><span style="color:#000000"><span style="color:#000000">YES;</span></span><span style="color:#008080"><span style="color:#008080">Ten</span></span> <span style="color:#000000"><span style="color:#000000">}</span></span><span style="color:#008080"><span style="color:#008080"></span> one</span> <span style="color:#008080"><span style="color:#008080"></span> a</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">called when it is about to lose its active state (loses focus, cannot Interact)</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span>- (<span style="color:#0000ff"><span style="color:#0000ff">void</span></span>) applicationwillresignactive: (uiapplication *<span style="color:#000000"><span style="color:#000000">) Application</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#000000"><span style="color:#000000">{</span></span><span style="color:#008080"><span style="color:#008080"></span> the</span>NSLog (<span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">resignactive</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#000000"><span style="color:#000000">);</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#000000"><span style="color:#000000">}</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">regain focus (ability to interact with Users)</span></span><span style="color:#008080"><span style="color:#008080"></span> +</span>- (<span style="color:#0000ff"><span style="color:#0000ff">void</span></span>) applicationdidbecomeactive: (uiapplication *<span style="color:#000000"><span style="color:#000000">) Application</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#000000"><span style="color:#000000">{</span></span><span style="color:#008080"><span style="color:#008080"></span> +</span>NSLog (<span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">becomeactive</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#000000"><span style="color:#000000">);</span></span><span style="color:#008080"><span style="color:#008080"></span> a</span> <span style="color:#000000"><span style="color:#000000">}</span></span><span style="color:#008080"><span style="color:#008080"></span> at</span> <span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">called when the application enters the background</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000">the <span style="color:#008000">Application's data is typically stored in this method, as well as the state</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span>- (<span style="color:#0000ff"><span style="color:#0000ff">void</span></span>) applicationdidenterbackground: (uiapplication *<span style="color:#000000"><span style="color:#000000">) Application</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#000000"><span style="color:#000000">{</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span>NSLog (<span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">Background</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#000000"><span style="color:#000000">);</span></span><span style="color:#008080"><span style="color:#008080"></span> in</span> <span style="color:#000000"><span style="color:#000000">}</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#008080"><span style="color:#008080"></span> to</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">called when the application is about to enter the foreground</span></span><span style="color:#008080"><span style="color:#008080"></span> +</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">typically restores the Application's data in this method, as well as the state</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span>- (<span style="color:#0000ff"><span style="color:#0000ff">void</span></span>) applicationwillenterforeground: (uiapplication *<span style="color:#000000"><span style="color:#000000">) Application</span></span><span style="color:#008080"><span style="color:#008080"></span> the</span> <span style="color:#000000"><span style="color:#000000">{</span></span><span style="color:#008080"><span style="color:#008080"></span> *</span>NSLog (<span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">Foreground</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#000000"><span style="color:#000000">);</span></span><span style="color:#008080"><span style="color:#008080"></span> $</span> <span style="color:#000000"><span style="color:#000000">}</span></span><span style="color:#008080"><span style="color:#008080">Panax Notoginseng</span></span> <span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">This method is called when the application is about to be destroyed</span></span><span style="color:#008080"><span style="color:#008080"></span> the</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">Note: This method cannot be called if the application is in a suspended state</span></span><span style="color:#008080"><span style="color:#008080"></span> +</span>- (<span style="color:#0000ff"><span style="color:#0000ff">void</span></span>) applicationwillterminate: (uiapplication *<span style="color:#000000"><span style="color:#000000">) Application</span></span><span style="color:#008080"><span style="color:#008080"></span> a</span> <span style="color:#000000"><span style="color:#000000">{</span></span><span style="color:#008080"><span style="color:#008080"></span> the</span> <span style="color:#000000"><span style="color:#000000">}</span></span><span style="color:#008080"><span style="color:#008080"></span> +</span> <span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">when the application receives a memory warning, it calls the</span></span><span style="color:#008080"><span style="color:#008080"></span> $</span> <span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">It is common to release unwanted memory in this method</span></span><span style="color:#008080"><span style="color:#008080"></span> $</span>- (<span style="color:#0000ff"><span style="color:#0000ff">void</span></span>) applicationdidreceivememorywarning: (uiapplication *<span style="color:#000000"><span style="color:#000000">) Application</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#000000"><span style="color:#000000">{</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span>NSLog (<span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">memorywarning</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#000000"><span style="color:#000000">);</span></span><span style="color:#008080"><span style="color:#008080"></span> the</span> <span style="color:#000000"><span style="color:#000000">}</span></span><span style="color:#008080"><span style="color:#008080"></span> -</span> <span style="color:#0000ff"><span style="color:#0000ff">@end</span></span></pre><span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span>Applications typically have five Statuses: official document App.states<strong><strong>three, The principle of program start</strong></strong><p style="margin-left:30px"><p style="margin-left:30px"><strong>Uiapplicationmain</strong></p></p><p style="margin-left:90px"><p style="margin-left:90px">A uiapplicationmain function is executed in the main Function.</p></p><p style="margin-left:90px"><p style="margin-left:90px">Intuiapplicationmain (int argc, Char *argv[], nsstring *principalclassname, nsstring *delegateclassname);</p></p><p style="margin-left:90px"><p style="margin-left:90px">argc, argv: Direct transfer to Uiapplicationmain for related processing can be</p></p><p style="margin-left:90px"><p style="margin-left:90px">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</p></p><p style="margin-left:90px"><p style="margin-left:90px">delegateclassname: Specifies the Application's proxy class, which must comply with the Uiapplicationdelegate protocol</p></p><p style="margin-left:90px"><p style="margin-left:90px">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</p></p><p style="margin-left:90px"><p style="margin-left:90px">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)</p></p><p style="margin-left:90px"><p style="margin-left:90px">The Uiapplicationmain function returns when the program exits normally</p></p><span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span><pre><span style="color:#0000ff"><span style="color:#0000ff">#import</span></span><UIKit/UIKit.h><span style="color:#0000ff"><span style="color:#0000ff">#import</span></span> <span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#800000"><span style="color:#800000">YYAppDelegate.h</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#0000ff"><span style="color:#0000ff">int</span></span>Main<span style="color:#0000ff"><span style="color:#0000ff">int</span></span>argc<span style="color:#0000ff"><span style="color:#0000ff">Char</span></span>*<span style="color:#000000"><span style="color:#000000">Argv[]) {@autoreleasepool {</span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">return uiapplicationmain (argc, argv, nil, nsstringfromclass ([yyappdelegate class])); </span></span><span style="color:#008000"><span style="color:#008000">//</span></span><span style="color:#008000"><span style="color:#008000">return uiapplicationmain (argc, argv, @ "uiapplication", nsstringfromclass ([yyappdelegate class]));</span></span> <span style="color:#008000"><span style="color:#008000">/*</span></span><span style="color:#008000"><span style="color:#008000">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. creates a U based on the incoming fourth generation Proxy for the IApplication object 3. Set the proxy object that was just created for UIApplication 4. Turn on an event loop</span></span><span style="color:#008000"><span style="color:#008000">*/</span></span> <span style="color:#0000ff"><span style="color:#0000ff">return</span></span>Uiapplicationmain (argc, argv,<span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">uiapplication</span></span><span style="color:#800000"><span style="color:#800000">"</span></span>,<span style="color:#800000"><span style="color:#800000">@"</span></span><span style="color:#800000"><span style="color:#800000">yyappdelegate</span></span><span style="color:#800000"><span style="color:#800000">"</span></span><span style="color:#000000"><span style="color:#000000">); }}</span></span></pre><span class="cnblogs_code_copy"><span class="cnblogs_code_copy"></span></span><p style="margin-left:60px"><p style="margin-left:60px"></p></p><p><p><strong>Code and parameter description for system entry:</strong></p></p>Argc: system or user-passed parameter argv: actual parameter passed in by the system or user 1. Based on the third parameter passed in, Create a UIApplication Object 2. Based on the fourth incoming agent that generated the UIApplication object, 3. Set the proxy object that you just created as a proxy for UIApplication 4. Turn on an event loop (which can be understood as a dead loop Inside) this time loop is a queue (advanced first The first to add in first<strong><strong>how iOS programs start</strong></strong><p><p>Iv. complete process of program initiation</p></p><p style="margin-left:30px"><p style="margin-left:30px"><span>1.</span>main function</p></p><p style="margin-left:30px"><p style="margin-left:30px"><span>2.</span>uiapplicationmain</p></p><p style="margin-left:30px"><p style="margin-left:30px">* Create UIApplication objects</p></p><p style="margin-left:30px"><p style="margin-left:30px">* Create a UIApplication delegate object</p></p><p><p></p></p><p style="margin-left:30px"><p style="margin-left:30px"><span>3.</span>delegate object starts processing (listening) system events (no Storyboard)</p></p><p style="margin-left:30px"><p style="margin-left:30px">* When the program is started, the Agent's application:didfinishlaunchingwithoptions is Called: method</p></p><p style="margin-left:30px"><p style="margin-left:30px">* Create UIWindow in Application:didfinishlaunchingwithoptions:</p></p><p style="margin-left:30px"><p style="margin-left:30px">* Create and set UIWindow Rootviewcontroller</p></p><p style="margin-left:30px"><p style="margin-left:30px">* Display window</p></p><p><p></p></p><p style="margin-left:30px"><p style="margin-left:30px"><span>3.</span> According to Info.plist to obtain the most important storyboard file name, load the main storyboard (with Storyboard)</p></p><p style="margin-left:30px"><p style="margin-left:30px">* Create UIWindow</p></p><p style="margin-left:30px"><p style="margin-left:30px">* Create and set UIWindow Rootviewcontroller</p></p><p style="margin-left:30px"><p style="margin-left:30px">* Display window</p></p><p><p>Program start principle and UIApplication</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