1.1UIApplication官方说明
The UIApplication class provides a centralized point of control and coordination for apps running in iOS. Every app has exactly one instance of UIApplication (or, very rarely, a subclass of UIApplication). When an app is launched, the system calls the UIApplicationMain function; among its other tasks, this function creates a singleton UIApplication object. Thereafter you access the object by calling the sharedApplication class method.
1.UIApplication:集中控制和协调iOS系统中应用程序的运行(应用程序的一个代表)每一个应用程序都有一个确定UIApplication或UIApplication子类的对象
2.UIapplication创建过程:当应用程序启动完以后,系统会调用UIApplicationMain方法,该方法就会创建一个单例的UIApplication对象。接下来程序员(我们开发人员)就可以调用UIApplication的sharedApplication方法使用UIApplication对象了。
A major role of your app’s application object is to handle the initial routing of incoming user events. It dispatches action messages forwarded to it by control objects (instances of the UIControl class) to appropriate target objects. The application object maintains a list of open windows (UIWindow objects) and through those can retrieve any of the app’s UIView objects.
1.UIApplication对象最重要的一个角色就是处理初始传入的用户事件,它分发这些消息到控制对象(UIControl的子类)或相应的目标对象。
2.UIApplication对象还维护了应用程序所打开的窗口(UIWindow对象)的一个列表,通过这个列表就能够检索到应用程序触发了那个UIView对象。
The UIApplication class defines a delegate that conforms to the UIApplicationDelegate protocol and must implement some of the protocol’s methods. The application object informs the delegate of significant runtime events—for example, app launch, low-memory warnings, and app termination—giving it an opportunity to respond appropriately.
UIApplication类定义了一个代理,凡是符合UIApplicationDelegate协议并且实现了该协议的方法的类都可以作为UIApplication的代理类。当应用程序发生重大的运行时事件时如:应用启动完毕、低内存警告和应用程序终止的时候会在适当的时机通知代理做出响应
Apps can cooperatively handle a resource, such as an email or an image file, through the openURL: method. For example, an app that calls this method with an email URL causes the Mail app to launch and display the message.
应用程序对象可以联合一些资源,如电子邮件或者图片文件,通过调用UIApplication的openURL:方法.例如,一个应用程序调用这个方法并且给一个email的URL就可以启动邮件应用程序并显示消息.
Subclassing Notes
Most apps do not need to subclass UIApplication. Instead, use an app delegate to manage interactions between the system and the app.
大多数应用程序都不需要继承UIApplication成为UIApplication的子类,只需要使用UIApplication的代理来管理应用程序和iOS系统之间的交互就可以了.