#import "QFAppDelegate.h"@implementationqfappdelegate//the last initialization function to execute//basically do some initialization before starting the Operation-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions{NSLog (@"didfinishlaunchingwithoptions"); //instantiating a window//initWithFrame Initialize position and size//[UIScreen mainscreen] Get Screen object//[[UIScreen mainscreen] bounds] get screen boundaries, including start position and screen size//cgrect Rectangle Size//Cgpoint Coordinate position//cgsize SizeSelf.window =[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]; //Override point for customization after application launch. //set the window background color//Uicolor Color ObjectsSelf.window.backgroundColor =[Uicolor Whitecolor]; //Custom Color RGBa//red,green,blue Value Range 0.0~1.0//Aplha Value range 0.0~1.0 0 is opaqueUicolor *c = [uicolor colorwithred:arc4random ()% the/255.0green:arc4random ()% the/255.0blue:arc4random ()% the/255.0Alpha:1.0]; Self.window.backgroundColor=C; //Display window[Self.window makekeyandvisible]; //UIView//What you can see on the screen is UIView's subclass . returnYES;}//coming into the background//stop some of the actions that are being performed- (void) Applicationwillresignactive: (UIApplication *) application{NSLog (@"applicationwillresignactive"); //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.}//has entered the background//Save as much of your app's current status as possible- (void) Applicationdidenterbackground: (UIApplication *) application{NSLog (@"Applicationdidenterbackground"); //Use the method to release the shared resources, save user data, invalidate timers, and store enough application state I Nformation 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.}//coming into the front desk//status before reverting to background- (void) Applicationwillenterforeground: (UIApplication *) application{NSLog (@"Applicationwillenterforeground"); //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.}//already at the front desk//tasks that were paused before restarting- (void) Applicationdidbecomeactive: (UIApplication *) application{NSLog (@"applicationdidbecomeactive"); //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.}//Program Exit- (void) Applicationwillterminate: (UIApplication *) application{NSLog (@"applicationwillterminate"); //Called when the application are about to terminate. Save data if appropriate. See also Applicationdidenterbackground:.}@end
A code function to start a UI Program Guide