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