IOS Uiapplicatin and its delegate

Source: Internet
Author: User

each uiapplication represents a should be shipped program, and UIApplication is a singleton class;

Once the iOS program is started, the first object created is the UIApplication object;// get UIApplication . Object *******************
uiapplication*appliction = [uiapplication sharedapplication];
// 1 : Set the red reminder number ********************** in the upper right corner of the application icon
Appliction.Applicationiconbadgenumber = 998;

// 2 : Set the visibility of the networking indicator *********************************
Appliction.networkactivityindicatorvisible = YES;

/** 3 : The status bar style status bar is hidden, displayed *****************************
3.1:Controller Management:
Style:-(Uistatusbarstyle) Preferredstatusbarstyle;
Visibility of:-(BOOL) Prefersstatusbarhidden;
3.2:byApplicationUnified Management one set The entire program is the same as the status bar
Benefits: Disposable Management to add animation effects
*: If you want to useuiapplicationto manage the status bar, you first have to modifyInfo.plistthe Settings
*/
// style
Appliction.Statusbarstyle = uistatusbarstylelightcontent;
// Visibility of Drive the painting
[ApplictionSetstatusbarhidden:YES withanimation:Uistatusbaranimationfade];

/* 4: Set openUrl ************************************
Call
UIApplication *app = [UIApplication sharedapplication];
[App Openurl:[nsurl urlwithstring:@ "tel://10086"];

Send SMS
[App Openurl:[nsurl urlwithstring:@ "sms://10086"];

send e-mail
[App Openurl:[nsurl urlwithstring:@ "Mailto://[email protected]"];

open a Web resource
[App Openurl:[nsurl urlwithstring:@ "http://ios.itcast.cn"];

Open Otherappprogram ....
*/=================================uiapplication's Delegate===============uiapplication delegate when the app was disturbed, Generates some system events, UIApplication notifies its delegate object, allowing the delegate agent to handle these system events each time you create a new iOS program, Xcode automatically generates a delegate class as the UIApplication delegate the main method inside to deal with the event
1 /*2 * The method called when the program is started is automatically called by the system3  */4-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) Launchoptions5 {6     //Override point for customization after application launch.7     returnYES;8 }9 Ten /* One * will lose focus, do not interact when calling this method A  */ -  -- (void) Applicationwillresignactive: (UIApplication *) Application the { -      - } -  +  - /* + * When the should be shipped program enters the background, it usually saves the state of the current program in the method . A  */ at- (void) Applicationdidenterbackground: (UIApplication *) Application - { -      - } -  -  in /* - * When the should be shipped program enters the foreground, it calls to reload the saved data . to  */ +- (void) Applicationwillenterforeground: (UIApplication *) Application - { the      * } $ Panax Notoginseng  - /* the * Regain focus to interact with users +  */ A- (void) Applicationdidbecomeactive: (UIApplication *) Application the { +  - } $  $  - /* - * This method is called when the should be shipped program is about to be destroyed if the should be shipped program is in a suspended state and cannot be called. the  */ -- (void) Applicationwillterminate: (UIApplication *) ApplicationWuyi { the      - } Wu  - /* About * should be shipped program memory warning method $ * Typically frees unwanted memory in this method -  */ -- (void) Applicationdidreceivememorywarning: (UIApplication *) Application - { A  +}


 

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.