#pragma mark calls after the application has finished loading
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
{
NSLog (@ "didfinishlaunchingwithoptions-loading complete");
Initialize a window
Self.window = [[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease];
Incoming xib file name to initialize a controller
Self.viewcontroller = [[[Mjviewcontroller alloc] initwithnibname:@ "Mjviewcontroller" Bundle:nil] autorelease];
Setting the root controller of a window
Self.window.rootViewController = Self.viewcontroller;
The following code is executed inside the code above:
[Self.window AddSubview:self.viewController.view];
The window does not appear by default and requires a method to be called to display
Keywindow is the main window, only the main window can interact with the user normally
[Self.window makekeyandvisible];
Self.window.hidden = NO;
return YES;
}
Called when the mark program loses focus #pragma (cannot interact with the user)
-(void) Applicationwillresignactive: (uiapplication *) application
{
NSLog (@ "applicationwillresignactive-loses focus");
}
#pragma mark is called when the application enters the background (click the Home button)
-(void) Applicationdidenterbackground: (uiapplication *) application
{
NSLog (@ "applicationdidenterbackground-into the background");
}
#pragma mark calls when the application enters the foreground
-(void) Applicationwillenterforeground: (uiapplication *) application
{
NSLog (@ "applicationwillenterforeground-Enter the front desk");
}
#pragma mark calls when the application gets focus
Get focus before you can interact with the user
-(void) Applicationdidbecomeactive: (uiapplication *) application
{
NSLog (@ "applicationdidbecomeactive-get Focus");
}
This method is called when the #pragma mark program is terminated in some cases
-(void) Applicationwillterminate: (uiapplication *) application
{
NSLog (@ "applicationwillterminate-is closed");
}
After the project starts:
first one IOS program [517:c07] didfinishlaunchingwithoptions- Load Complete
first one IOS program [517:c07] applicationdidbecomeactive- Get Focus
Press the home button:
first one
IOS
program
[517:c07] applicationwillresignactive-
Lose Focus
first one IOS program [517:c07] applicationdidenterbackground- Go Backstage
Then press the program:
first one IOS program [517:c07] applicationwillenterforeground- Access to reception
first one IOS program [517:c07] applicationdidbecomeactive- Get Focus
Appdelegate Life Cycle Detailed