Method trigger time in Appdelegate class in iOS-----custom appdelegate

Source: Internet
Author: User

@implementation appdelegate//triggers when the application loads, creates a Window object, makes the object's window the main window of the program, and is visible.-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions {Self.window=[[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease]; //Override point for customization after application launch. //__function__ The number of rows where the method name __line__ is locatedNSLog (@"%s,%d", __function__,__line__); Self.window.backgroundColor=[Uicolor Whitecolor];    [Self.window makekeyandvisible]; returnYES;}//the application is going to cancel the active state is triggered '//Use this method to pause the task that is being performed, to invalidate the timer, and to pause the game.- (void) Applicationwillresignactive: (UIApplication *) Application {NSLog (@"%s,%d", __function__,__line__); //Sent when the application are about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as a incoming phone call or SMS message) or when the US    Er quits the application and it begins the transition to the background state. //Use the This method to the pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.}//triggered when an application enters the background//release the shared resources, save the user data, let the timer expire, save the current program will be replaced when exiting Applicationwillterminate- (void) Applicationdidenterbackground: (UIApplication *) Application {NSLog (@"%s,%d", __function__,__line__); //Use the method to release the shared resources, save user data, invalidate timers, and store enough application state in    Formation to the restore your application to the it is terminated later. //If Your application supports background execution, this method is called instead of Applicationwillterminate:when th E user quits.}//triggered when an application is going to enter the foreground//The task is running while continuing into the background, the game continues- (void) Applicationwillenterforeground: (UIApplication *) Application {NSLog (@"%s,%d", __function__,__line__); //Called as part of the transition from the background to the inactive state; Here you can undo many of the changes mad E on entering the background.}//triggered when an application becomes active//restarts the task that is paused when the current application enters an active state, and optionally refreshes the interface if the previous program is in the background.- (void) Applicationdidbecomeactive: (UIApplication *) Application {NSLog (@"%s,%d", __function__,__line__); //Restart Any tasks this were paused (or not yet started) while the application is inactive. If the application is previously in the background, optionally refresh the user interface.}- (void) Applicationwillterminate: (UIApplication *) Application {//Called when the application are about to terminate. Save data if appropriate. See also Applicationdidenterbackground:.}-(void) dealloc{[_window release]; [Super Dealloc];} @end

Rewrite appdelegate

Lodelegate, pay attention to inheritance

Uiresponder<uiapplicationdelegate>
@interface lodelegatre:uiresponder<uiapplicationdelegate>*window; @end
" LODelegatre.h " @implementation lodelegatre-(BOOL) Application: (UIApplication *) application Willfinishlaunchingwithoptions: (nsdictionary *) launchoptions {        = [[[UIWindow alloc] initWithFrame: [[UIScreen mainscreen] bounds] Autorelease];;     = [Uicolor yellowcolor];    [Self.window makekeyandvisible];     return YES;} -(void) dealloc{    [_window release];    [Super Dealloc];} @end

Method trigger time in Appdelegate class in iOS-----custom appdelegate

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.