Description of functions in APPDELEGATE.M

Source: Internet
Author: User

Uiapplicationdelegate is one of the most common protocols

This protocol declares a delegate method that inherits from the UIApplication object in singleton mode. These methods provide an opportunity to respond when an application executes or when significant changes occur. For example (when the application executes, when the boot is complete, the memory is low ...). )

One of the main tasks of the Application object delegation method is to track the application.

For these responses, programmers need to implement some or all of their own requirements

Now, let's look at the protocol's method Task.

Monitoring application state changes (monitoring application status changes)

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions//when the application has started, and there may be additional startup options to process the delegate//It is strongly recommended that you use this method to initialize your application, rather than using the Applicationdidfinishlaunching method, which is in the Apple document ... applicationdidfinishlaunching, isn't it real? ... ==! - (void) Applicationdidbecomeactive: (uiapplication *) application//application into activation state- (void) Applicationwillresignactive: (uiapplication *) application//application into background (inactive) state-Applicationdidenterbackground: (uiapplication *) application//The application is transferred from the activation state to the background (between active and inactive?). (Response to Home button))-Applicationwillenterbackground: (uiapplication *) application//the application moves from the activation state to the background (one step ahead of the previous method ....) It doesn't seem like much difference.)-Applicationwillterminate://when the application terminates-Applicationdidfinishlaunching://Application Startup

Opening a URL Resource (opens a URL resource)

-(BOOL) Application: (UIApplication *) application Handleopenurl: (nsurl *) URL// request delegate open a URL resource  -(BOOL) Application: (UIApplication *) application OpenURL: (nsurl *) URL sourceapplication: (NSString *) sourceapplication annotation: (ID) annotaion// request delegate open a URL resource


Managing status bar changes (management (listening) status bar changed)

-(void) Application:(uiapplication *) application willchangestatusbarorientation: (uiinterfaceorientation) Newstatusbarorientation Duration: (nstimeinterval) duration-(void) Application:(uiapplication *) Application didchangestatusbarorientation: (uiinterfaceorientation) oldstatusbarorientation-(void) Application:(UIApplication *) application Didchangestatusbarframe: (cgrect) oldstatusbarframe-(void) Application:(UIApplication *) application Willchangestatusbarframe: (cgrece) Newstatusbraframe

Responding to system notifications (response notification)

-applicationdidreceivememorywarning://  -applicationsignificanttimechange when memory low alarm :  when the system time has changed significantly

Handling remote notifications (for remoting messages)

-(void) Application:(uiapplication *) application didreceiveremotenotification: (nsdictonary *) UserInfo   When a running application receives a remote notification sent to the delegate to go ...  -(void) Application:(UIApplication *) application Didregisterforremotenotificationswithdevicetoken: (NSData *) Devicetoken// When an application successfully registers a push service (APS) Send to delegate go ...  -(void) Application:(UIApplication *) application Didfailtoregisterforremotenotificationswitherror: (nserror *) error// When APS cannot successfully complete a push to the program process to send to the delegate ... 

Handling local Notification (processing native messages)

-(void) Application:(uiapplication *) application didreceivelocalnotification: (Uilocalnotification *) Notification// 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)

-applicationprotecteddatawillbecomeunavailable://  notification delegate, protected file currently becomes unavailable  - Applicationprotecteddatawillbecomeavailable://  notify delegates  that a protected file is currently available


Uiapplicationdelegate, that's all this stuff ....

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.