IOS program Run Process

Source: Internet
Author: User

The first write a little bit nervous hope that everyone more advice!

The main talk of the program from the click Run to the end of the process of the following code changes.

First, let's look at uiapplication. the core role of UIApplication is to provide control and collaboration during iOS operations.

1. The first priority is to handle user events, placing all events in one queue and processing them individually. Place the event that is currently being processed into a suitable target control for handling the event.

2. Second, the UIWindow instance opened in this application is also maintained so that he can access any of the UIView objects in the application. He's going to be given a proxy object uiapplicationdelegate, which handles application lifecycle events, system events (incoming calls, warnings). You can call [UIApplication sharedapplication] to get an instance of him.

The entrance to the program is the main.m file

int main (int argc, char * argv[]) {
@autoreleasepool {
Return Uiapplicationmain (argc, argv, Nil, Nsstringfromclass ([Appdelegate class]));
}
}

The third parameter, which is aUIApplication类名或者是其子类名,如果是nil,
则就默认使用UIApplication类名。
第四个参数是协议UIApplicationDelegate的实例化对象名,
如果是nil,则从main nib文件中加载委托对象。
这个对象就是UIApplication对象监听到系统变化的时候通知其执行的相应方法。

Callback for the agent when each program is running state:

-(BOOL) Application: (UIApplication *) application willfinishlaunchingwithoptions: (nsdictionary *) launchOptions
Tells the agent that the process has started but has not yet entered a state save
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
Tells the agent to start the basic Completion program ready to start running
-(void) applicationwillresignactive: (uiapplication *) application
    When an application is going into an inactive state, during which time the application does not receive messages or events, such as a call to the
-(void) Applicationdidbecomeactive: ( UIApplication *) application 
      When the application is in the active state, this is just the opposite of the method above
-(void) Applicationdidenterbackground: (uiapplication *) application
    Called when the program is pushed to the background. So to set the background to continue running, you can set the function inside the
-(void) Applicationwillenterforeground: (uiapplication *) Application
-(void) Applicationwillterminate: (uiapplication *) application
When the program is going to exit is called, it is usually used to save the data and some cleanup work before exiting. This needs to set the key value of the uiapplicationexitsonsuspend.
-(void) applicationdidfinishlaunching: (uiapplication*) application

IOS program Run process

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.