Appdelegate's Related introduction
iOS notes
@interface Appdelegate:uiresponder <UIApplicationDelegate>
@property (Strong, nonatomic) UIWindow *window;
Appdelegate events that can be handled include:
1> life-Cycle events for applications (such as program startup and shutdown);
2> system events (such as incoming calls);
3> Memory Warning ...
Appdelegate is a proxy for the entire application, providing a similar monitoring interface for program startup, exit, etc.
The header file introduced by Appdelegate is #import <UIKit/UIKit.h>
Inherit from Uiresponder Uiresponder contains UIView, Uiviewcontroller, uiapplication three large categories,
UIView is mainly the display of the space Uiviewcontroller is mainly the display of the window uiapplication is mainly to receive all kinds of events,
And there's a main window, a view of the controller is displayed on the window,
Following the Uiapplicationdelegate protocol, from the main function, Appdelegate is a class that adheres to the UIApplication protocol, listening to events that listen to the entire application life cycle.
The role of the methods defined in the protocol that require implementation:
Application didfinishlaunchingwithoptions: (nsdictionary *) launchoptions
Description: The delegate call to execute after the application starts (loading of the first page)
1,-(void) Applicationwillresignactive: (uiapplication *) application
Description: When an application is about to go into an inactive state, during which time the application does not receive messages or events, such as coming to the phone
2,-(void) Applicationdidbecomeactive: (uiapplication *) application
Description: When the application goes into active execution, this is exactly the opposite of the method above
3,-(void) Applicationdidenterbackground: (uiapplication *) application
Description: Called when the program is pushed to the background. So to set the background to continue running, you can set it in this function
4,-(void) Applicationwillenterforeground: (uiapplication *) application
Description: Called when the program is going back to the foreground from the background, which is exactly the opposite of the method above.
5,-(void) Applicationwillterminate: (uiapplication *) application
Description: When the program is about to exit is called, it is usually used to save the data and some cleanup work before exiting. This needs to set the key value of the uiapplicationexitsonsuspend.
6,-(void) applicationdidreceivememorywarning: (uiapplication *) application
Description: The iphone device has only limited memory, and if the application is assigned too much memory the operating system will terminate the application's operation, this method will be executed before termination, usually can be done in the memory cleanup work to prevent the program from being terminated
7,-(void) Applicationsignificanttimechange: (uiapplication*) application
Description: Executes when the system time has changed
8,-(void) applicationdidfinishlaunching: (uiapplication*) application
Description: Executes when the program is loaded
9,-(void) application: (uiapplication) Application Willchangestatusbarframe: (cgrect) Newstatusbarframe
Description: Executes when the StatusBar box is going to change
10,-(void) application: (uiapplication*) Application willchangestatusbarorientation:
(uiinterfaceorientation) newstatusbarorientation
Duration: (nstimeinterval) duration
Description: Executed when the StatusBar box direction is going to change
11,-(BOOL) Application: (uiapplication*) Application Handleopenurl: (nsurl*) URL
Description: When executing via URL
12,-(void) application: (uiapplication*) Application didchangestatusbarorientation: (uiinterfaceorientation) Oldstatusbarorientation
Description: Executes when the StatusBar box direction changes
13,-(void) application: (uiapplication*) Application Didchangesetstatusbarframe: (cgrect) Oldstatusbarframe
Description: Executes when the StatusBar box changes
Handling remote notifications (for remoting messages)
14,-(void) Application: (UIApplication *) Applicationdidreceiveremotenotification: (Nsdictonary *) userinfo
Description: When a running application receives a remote notification sent to the delegate to go ...
15,-(void) Application: (UIApplication *) Applicationdidregisterforremotenotificationswithdevicetoken: (NSData *) Devicetoken
Description: When an application succeeds in registering a push service (APS) to send to the delegate to go ...
16,-(void) Application: (UIApplication *) Applicationdidfailtoregisterforremotenotificationswitherror: (NSError *) Error
Description: When APS cannot successfully complete a push to the program process to send to the delegate ...
Handling local Notification (processing native messages)
17,-(void) Application: (UIApplication *) Applicationdidreceivelocalnotification: (Uilocalnotification *) Notification
Description: When a running application receives a local notification sent to the delegate to go ...
Responding to content protections changes (changes in response to protected content)
18,-applicationprotecteddatawillbecomeunavailable:
Description: A notification delegate that the protected file currently becomes unavailable
19,-applicationprotecteddatawillbecomeavailable:
Description: Notifies the delegate that a protected file is currently available
Ppdelegate's Related introduction