Summary of proxy methods for iOS UIApplication

Source: Internet
Author: User

1. Introduction

1>The whole application symbolizes that an application is a UIApplication object and uses the singleton design mode.

2>Access this singleton object through [UIApplication sharedApplication]

2. Common usage

1>Set the red number in the upper-right corner of the icon

App. applicationIconBadgeNumber = 10;

2>Set the style of the status bar

App. statusBarStyle = UIStatusBarStyleBlackOpaque;

3>Control display and hide of Status Bar

App. statusBarHidden = YES;

4>Show the circle above the status bar

App. networkActivityIndicatorVisible = YES;

5>Open external resources

  • Open webpage

    [App openURL: [NSURL URLWithString: @ "http://www.baidu.com"];
  • Call

    [App openURL: [NSURL URLWithString: @ "tel: // 10086"];
  • Text message

    [App openURL: [NSURL URLWithString: @ "sms: // 10086"];

6> proxy properties when some system-level events occur in the application, the agent will be notified and handed over to the agent for processing)

@ Property (nonatomic, assign) id delegate;

Proxy method of UIApplicationDelegate

Once the pragma mark program is loaded and started)

  • (BOOL) application :( UIApplication) application didfinishlaunchingwitexceptions :( NSDictionary) launchOptions

Call when The pragma mark application loses focus (if an app loses focus, it cannot interact with users)

  • (Void) applicationWillResignActive :( UIApplication *) application

The pragma mark program is called when it enters the background.

  • (Void) applicationDidEnterBackground :( UIApplication *) application

Called when The pragma mark program is about to enter the foreground

  • (Void) applicationWillEnterForeground :( UIApplication *) application

Call when The pragma mark application gets the focus (an app can interact with users only after the focus is obtained)

  • (Void) applicationDidBecomeActive :( UIApplication *) application

The pragma mark program may be called when it is about to be closed.

  • (Void) applicationWillTerminate :( UIApplication *) application

When The pragma mark program receives a memory warning, it will call

  • (Void) applicationDidReceiveMemoryWarning :( UIApplication *) application

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.