iOS Development uiapplication and delegate

Source: Internet
Author: User

1 , overview

All mobile operating systems have a fatal disadvantage: apps are vulnerable to interruptions. For example, a call or lock screen will cause the app to go backstage or even be terminated.

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.

Delegate the events that can be handled include:

(1) Application lifecycle events (such as program startup and shutdown)

(2) System events (such as incoming calls)

(3) Memory warning

(4) ...

2 , uiapplicationdelegate

Every time a new project is completed, there is a class with the word "appdelegate", which is the agent of UIApplication.

Mjappdelegate has complied with the Uiapplicationdelegate protocol by default and is already a proxy for uiapplication.

We can implement the corresponding methods directly in the mjappdelegate as needed, and these methods will be called automatically when the corresponding situation occurs. For example, we can be in Mjappdelegate-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: ( Nsdictionary *) Launchoptions; Creates a controller in the method and sets the Rootviewcontroller to the window.

iOS Development uiapplication and delegate

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.