IOS Development Learning User Interface (1) APP life cycle

Source: Internet
Author: User

One, APP life cycle

OC Learning under the Fundation framework, the UI phase of learning is under the Uikit framework (COCOA: OS X and iOS operating environment) under the touch layer (Cocoa touch layers).

Application Portal * * *

Main function:

int uiapplicationmain (int argc,char *argv[], nsstring *principalclassname,nsstring *delegateclassname);

ARGC, argv is passed to Uiapplicationmain by the main function. Parameters contain when and where the application starts from the system.

Principalclassname the name of the class that identifies the application, which must be the class name of the UIApplication class or its subclasses. If nil is passed, the default is the class name of UIApplication. (The boss of the entire application)

Delegateclassname the name of the proxy class that identifies the application class (UIApplication). (responsible for high-level interactions between systems and applications, such as the life cycle of the Boss)

The Uiapplicationmain function instantiates an Application object and an application proxy object by receiving the third, fourth argument. In addition, 1. Set up an event loop for the application and start handling events; 2. Loads the specified main view file from Info.plist.

Application life cycle

In APPDELEGATE.M

1:

Application:didfinishlaunchingwithoptions: Application ready, finished loading, ready to run

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {

Override point for customization after application launch.

return YES;

}

2:

Program changes to Active state

Restart those tasks that are paused when the application is inactive (or tasks that have not been started), or if the application was previously in the background, then selectively refresh the user interface

-(void) Applicationdidbecomeactive: (uiapplication *) Application {

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.

}

3

The application is about to release the activation state (not yet activated) and start to inactive

This method occurs when the application moves from the active state to the inactive state, typically in several specific temporary interrupts (calls, or text messages), or when the user exits the application and turns to the background. (Active, inactive, background-three states)

Use this method to pause a running task, disable the timer, reduce the graphics frame rate of 3D, and pause the game if it is a game

-(void) Applicationwillresignactive: (uiapplication *) Application {

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.

}

4

Application into the background

Use this method to release a shared resource, save the user data, invalidate the timer, and save sufficient application state information in order to restore the application to its current state, in case a subsequent return to the application

If the application supports background execution, this method replaces Applicatiowillterminate: The program terminates completely when the user exits the application

-(void) Applicationdidenterbackground: (uiapplication *) Application {

Use the This method to release the shared resources, save user data, invalidate timers, and store enough application state info Rmation 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 the User quits.

}

5

Application will enter the foreground

Occurs in the process of transitioning from that background to the non-active state

You can restore the changes you made before you entered the background

-(void) Applicationwillenterforeground: (uiapplication *) Application {

Called as part of the transition from the background to the inactive state; Here's can undo many of the changes made on entering the background.

}

6

The application will be terminated (the main judge is whether the program supports background execution)

-(void) Applicationwillterminate: (uiapplication *) Application {

Called when the application are about to terminate. Save data if appropriate. See also Applicationdidenterbackground:.

}

App Name & App Logo

A. Name of the App name displayed on the phone screen (note the distinction from the project name)

Add the Bundle display name in Info.plist, the value can be set arbitrarily, both in English and Chinese. General control in Chinese 5 words or less. , there is an ellipsis when the screen is displayed.

B. App Logo

APP because it can be run on different versions of the device, so the size of the logo there are many kinds of, ideally, it is best for each device is ready for the corresponding size of the logo. (There are several more to be prepared on shelves).

Note: The dimension units in Xcode are PT (points), and the dimensions of the picture are px (pixels). Their relationship: A point can have more than one pixel, popular speaking: a point can drop a few drops of paint, the more, the clearer the figure.

In Assets.xcassets->appicon, 1x,2x,3x indicates that there are 1/2/3 pixels at a point, such as 2x at 60PT, to set a 120-pixel picture.

IOS Development Learning User Interface (1) APP life cycle

Related Article

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.