20161008 UIApplication、UIScreen、UIWindow

UIApplication:

链接:UIApplication简介

(1)一个UIApplication对象就代表一个应用程序

(2)通过[UIApplication sharedApplication]可以获得UIApplication单例对象

(3) 一个iOS程序启动后创建的第一个对象就是UIApplication对象

(4)利用UIApplication对象,能进行一些应用级别的操作

20161008 UIApplication、UIScreen、UIWindow_第1张图片
初学者

链接:UIApplicationMain函数介绍(官方文档)

函数Discussion:

This function *1*instantiates the application object from the principal class and *2*instantiates the delegate (if any) from the given class and sets the delegate for the application. It also *3*sets up the main event loop, including the application’s run loop, and begins processing events. If the application’s Info.plist file specifies a main nib file to be loaded, by including the NSMainNibFile key and a valid nib file name for the value, this function loads that nib file.Despite the declared return type, this function never returns.

单词:

corresponding(相应的,匹配的)     despite(尽管)     declared(公布)     declaration(宣称)


UIScreen:

链接:UIScreen官方文档翻译

A UIScreen object defines the properties associated with a hardware-based display. iOS devices have a main screen and zero or more attached screens. A tvOS device has a main screen for the television connected to the device. Use this class to obtain screen objects for each display attached to the device. Each screen object defines the bounds rectangle for the associated display and other interesting properties such as its brightness.

overview:

*1*Prior to iOS 8, a screen’s bounds rectangle always reflected the screen dimensions relative to a portrait-up orientation. Rotating the device to a landscape or upside-down orientation did not change the bounds. *2*In iOS 8 and later, a screen’s bounds property takes the interface orientation of the screen into account. This behavior means that the bounds for a device in a portrait orientation may not be the same as the bounds for the device in a landscape orientation. Apps that rely on the screen dimensions can use the object in the fixedCoordinateSpace property as a fixed point of reference for any calculations they must make.

fixedCoordinateSpace:The fixed coordinate space of the screen.

单词:

associated with...(和...相关)     prior to...(在...之前)     dimensions(尺寸)     reflect(反映、反射)     portrait-up orientation(肖像/正面朝上方向)     in a landscape orientation(横向)     take ... into account(考虑...)     coordinate(坐标)     fixed(修正的)  

iOS中主要利用UIScreen来获取物理屏幕尺寸和设置屏幕亮度:

CGRect rect = [[UIScreen mainScreen] bounds];

[[UIScreen mainScreen] setBrightness:0.5];


UIWindow:

链接:UIWindow简介      UIWindow简介2      官方文档

A UIWindow object *1*provides the backdrop for your app’s user interface and *2*provides important event-handling behaviors. Windows do not have any visual appearance of their own, but they are crucial to the presentation of your app’s views. Every view that appears onscreen is enclosed by a window, and each window is independent of the other windows in your app. Events received by your app are initially routed to the appropriate window object, which in turn forwards those events to the appropriate view. Windows work with your view controllers to implement orientation changes and to perform many other tasks that are fundamental to your app’s operation.

单词:

crucial(重要的)     enclose(附着的)      independent(独立的)      appropriate(适当的)     route(按路线发送)     fundamental(基础的)


你可能感兴趣的:(20161008 UIApplication、UIScreen、UIWindow)