First, UIApplication life cycle
Each iOS application contains a UIApplication object, and the iOS system monitors the entire application lifecycle through the UIApplication object. Each application specifies a proxy object for the UIApplication object that handles the UIApplication object monitoring lifecycle event.
Two, iOS app has 5 kinds of status
- Not Running: The application is not started or the application is running and is stopped by the system halfway.
- Inactive: The application is running in the foreground, but does not receive events. (currently or executing other code)
- Active: The current application is running in the foreground and receives events.
- Background: The application is in the background, and the code is still executing.
- Suspended: The application is in the background and stops executing code.
Third, the Agent object Uiapplicationdelegate object: is responsible for processing uiapplication in the life cycle monitoring event.
Four, in the UIApplication proxy object, the life cycle-related functions:
1 // 2- (void) Applicationwillresignactive: (UIApplication *) Application3 4 //5- (void) Applicationdidbecomeactive: (UIApplication *) Application6 7 // 8- (void) Applicationdidenterbackground: (UIApplication *) Application9 Ten // One- (void) Applicationwillenterforeground: (UIApplication *) Application A - // -- (void) Applicationwillterminate: (UIApplication *) Application the - // -- (void) Applicationdidreceivememorywarning: (UIApplication *) Application - + // -- (void) Applicationdidfinsihlaunching: (UIApplication *) Application + A // at-(BOOL) Application: (UIApplication *) application Handleopenurl: (nsurl *) URL
V. uiviewapplication life cycle
The principles of the IOS program life cycle