A brief description of Uiapplication/uiscreen/uidevice in the Apple Developer documentation

Source: Internet
Author: User
Tags home screen uikit
<span id="Label3"></p><pre><pre><code>UIApplication/UIScreen/UIDevice平常用的很少;但毕竟是属于UIKit的重要组成部分,有必要了解一下。</code></pre></pre><p><p>Uidevice</p></p><p><p>You can obtain a singleton that describes the current device through UIDEVICE. You can get information about device name, device model, operating system name, and version of the Device.</p></p><p><p>We can also detect the change of the device by Uidevice instance, than Fang or vertical Screen. The Orientation property represents the orientation of the device, and can also be used to obtain the azimuth change in real time by registering the Uideviceorientationdidchangenotification notification Message. Before you can use this data, you must first turn on the feature through the Begingeneratingdeviceorientationnotifications method Call. Then call Endgeneratingdeviceorientationnotifications to disable the Feature.</p></p><p><p>In addition, we can obtain information and notification information (batterystate,batterylevel) about the change of the power status. There is also the proximity sensor data (proximitystate), which is used to detect whether the user is holding the phone and clinging to the Face. similarly, the above two functions are only opened when Necessary.</p></p><p><p>Starting with iOS4.2, We can use the Playinputclick instance method to respond to user-defined keyboard actions.<br>UIApplication</p></p><p><p>UIApplication is a center for controlling and coordinating the application in Operation. Any application has and has only one uiapplication (or one subclass of a uiapplication). Once the app is started, Uiapplicationmain is Called. In a task that is applied, this function creates an uiapplication Singleton. therefore, you can use Sharedapplication to get the Object.</p></p><p><p>An important function of uiapplication is that it is the beginning of all user action event delivery chains. It will also be passed by the Uicontrol class to its action information to further distribute the appropriate target class. In addition, the UIApplication object maintains a list of all windows that are open in the current app. An Application object typically has an agent that handles application Run-time information, such as application open, low memory, and app Shutdown. So applications have the opportunity to deal with these important information.</p></p><p><p>The app can be previously collaborated through the OpenURL method, such as processing resources like email and image files. For example, an app opens a call to the email URL, using this method to open the mail client and display the Information.</p></p><p><p>The UIApplication interface allows you to manage device-related behavior, as Follows:</p></p><p><p>Control the reaction of the application when the orientation of the equipment changes;</p></p><p><p>Temporarily block Touch Events.</p></p><p><p>Turn the proximity sensor on and off.</p></p><p><p>Registers a remote notification Message.</p></p><p><p>Trigger undo or Redo UI (applicationsupportsshaketoedit)</p></p><p><p>Detects if an installed app can open a URL (canopenurl:).</p></p><p><p>Before the app is back in the background, let it run again in the background to finish some finishing Touches.</p></p><p><p>Schedule or Abort local notifications.</p></p><p><p>Handles the received remote control events Together.</p></p><p><p>Resumes the status of the app.</p></p><p><p>The vast majority of applications do not need to create uiapplication subclasses, only need to use Uiapplication's proxy functions to manage the interaction between the system and the Application.</p></p><p><p>If you need to implement a custom event or action distribution system, you need to create a uiapplication subclass. In this case, you need to rewrite the Sendevent or SendAction method to customize the distribution Mechanism. We try to avoid this Situation.<br>UIScreen</p></p><p><p>The UIScreen object defines the properties associated with the hardware display. The iOS device has a home screen, plus 0 or more screens Attached. This class can get all the screen related to the Device. The screen class defines bounds, as well as other properties such as Contrast.</p></p><p><p>Before iOS8, the Bounds property of screen must reflect the size of the screens on the vertical Screen. Rotating the screen to a horizontal or inverted condition does not change the bounds Property. Starting with iOS8, the bounds attribute refers to the change in device Orientation. Apps that depend on screen size can use the Fixedcoordinatespace property to correct the Point's position in Coordinates.</p></p><p><p>When the user connects or disconnects the screen, the system sends a notification to the app. Agents can be used to monitor notification information for a long time. Notifications of connections and disconnects may occur at any time, and your app may be suspended in the Background. When the app hangs, the notification is saved in the queue until your app starts running in the foreground or in the Background.</p></p><p><p>however, You can use this extra screen space when the system notifies you of an external screen Connection. To use this space, you need to create a UIWindow object, assign a value to the new screen, and display it on the WINDOW. The screen supports multiple resolutions, which use different pixel aspect ratios. Screen objects use the most common screen mode, and you can also set the mode that suits YOU. For example, If you use OpenGL in a game app</p></p><p><p>ES, based on the 640*480 design texture, You can update the screen mode to a higher Resolution.</p></p><pre><pre><code>总结:1,开发中接触到UIApplication/UIScreen/UIDevice的机会不多;而且大多是简单的应用;对其有个大概了解即可;2,以上内容都翻译自苹果官方内容,以下为链接https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/index.html#//apple_ref/occ/cl/UIDevicehttps://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/occ/cl/UIApplicationhttps://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScreen_Class/index.html#//apple_ref/occ/cl/UIScreen</code></pre></pre><p><p>The more you learn, the faster you do, the more you learn, the better you do;</p></p> <p style="font-size:12px;"><p style="font-size:12px;">Copyright Notice: This article for Bo Master original article, without Bo Master permission not Reproduced.</p></p> <p><p>A brief description of Uiapplication/uiscreen/uidevice in the Apple Developer documentation</p></p></span>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.