标签:
The UIApplication
class provides a centralized point of control and coordination for apps running on iOS. Every app must have exactly one instance of UIApplication
(or a subclass of UIApplication
). When an app is launched, the UIApplicationMain
function is called; among its other tasks, this function creates a singleton UIApplication
object. Thereafter you access this object by invoking the sharedApplication
class method.
UIApplication类提供了运行在iOS上的apps的控制和协调的集中点。每个应用都必须有一个确切的UIApplication实例(或者UIApplication的子类)。当一个app运行时
UIApplicationMain 方法会被调用;在它的其它任务中,这个方法创建了一个单个UIApplication对象。此后通过调用sheredApplication 类方法来访问这个对象。
A major role of a UIApplication
object is to handle the initial routing of incoming user events. It also dispatches action messages forwarded to it by control objects (UIControl
) to the appropriate target objects. In addition, the UIApplication
object maintains a list of all the windows (UIWindow
objects) currently open in the app, so through those it can retrieve any of the app’s UIView
objects. The app object is typically assigned a delegate, an object that the app informs of significant runtime events—for example, app launch, low-memory warnings, and app termination—giving it an opportunity to respond appropriately.
UIApplication对象的一个主要角色就是处理将来用户事件的初始化崩溃。崩溃也会通过合适的目标对象的UIControl对象发送动作信息给UIApplication对象。另外,UIApplication对象维持着一个当前app所有打开的所有窗口UIWindow对象的表,所以通过这些它可以取得任意app的UIView对象。app对象通常分配给一个delegate,这个对象是app运行时的重大事件通知,比如说,应用运行,低内存警告,应用终止运行,它提供了一个处理的机会。
Apps can cooperatively handle a resource such as an email or an image file through the openURL:
method. For example, an app opening an email URL with this method may cause the mail client to launch and display the message.
应用可以通过openURL:方法来协同地处理一个资源,比如一个邮件或者一个图片文件。比如说,一个app用这个方法打开了一个邮件地址可以会使邮件客户端打开显示信息。
The programmatic interfaces of UIApplication
allow you to manage behavior that is specific to the device. Use this object to do the following:
UIApplication界面纲领允许管理硬件明确的行为。使用这个类来进行以下操作。
Control the app’s response to changes in interface orientation.
Temporarily suspend incoming touch events.
Turn proximity sensing (of the user’s face) off and on again.
Register for remote notifications.
Trigger the undo-redo UI (applicationSupportsShakeToEdit
).
Determine whether an installed app can open a URL (canOpenURL:
).
Extend the execution of the app so that it can finish a task in the background.
Schedule and cancel local notifications.
Coordinate the reception of remote-control events.
Perform app-level state restoration tasks.
UIApplication
defines a delegate that must adopt the UIApplicationDelegate
protocol and implement some of the protocol methods.
UIApplication定义了一个必须采用UIApplicationDelegate协议和实现一些协议里的方法delegate
标签:
原文地址:http://www.cnblogs.com/baaingSheep/p/4542829.html