( sharedapplication] return uiapplication * application = nil;
+ (uiapplication*) shareapplication{
if (application = = nil) {
application= [[uiapplication Alloc]init];
}
return application;
}
When uiapplication receives all system events and lifecycle events, it passes the event to uiapplicationdelegate for processing, and for the user input event, it is passed to the corresponding target object to be processed. For example, we can invoke the applicationwillresignact ive () method of the application delegate class after a message such as an application is called, which is also called when the user locks the screen, adapting to the delegate method when the application is re-opened by the user. Another common use is an out-of-memory system warning that invokes the Applicationdidreceivemem orywarning () method of the application's delegate class, and then we can try to free up some memory.
Understanding of [UIApplication sharedapplication]