"iOS Dev-25" Uidevice View system Information, start with a question how to quickly find the properties and methods you want and understand it

Source: Internet
Author: User

Suppose you need to solve the problem: When you write code, you encounter a situation, you need to determine the iOS version, may be lower and higher version of the need to add some code, at this time, how to determine the iOS version?


(1) The first step, of course Niang, enter "IOS Judgment System version".


(2) The second step: Open the first few you will find, in fact, there are [uidevice Currentdevice] figure, even if it is a novice, it is estimated that uidevice should be a big boss, we in their own xcode input this.


(3) Step three: We hold cmd when the mouse through Uidevice time can be clicked, so click on the teenager, and then into a piece of code in the sea.


(4) In fact, there are almost all properties of the property, not nearly all methods, the former with a point attribute "." To invoke, the latter is generally directly input.


(5) If you are a bit familiar with the methods or attributes you need, you can cmd+f input fuzzy queries so that you can quickly locate what you need.


The information that is commonly used by the device is then used:

    Gets the version number of iOS, such as 8.0    NSLog (@ "%@", [[Uidevice currentdevice]systemversion]);    Get system name such as iphone OS    NSLog (@ "%@", [[Uidevice currentdevice]systemname]);    Get the device name, who belongs to the device, namely the registered Apple account, the analog is the iphone Simulator    NSLog (@ "%@", [[Uidevice currentdevice]name]);    Device models, such as iphone or ipad, are the analog iphone Simulator    NSLog (@ "%@", [[Uidevice Currentdevice]model]);    can also get battery usage, but also to get the screen is vertical screen or horizontal screen and other information

another question:

The height of the navigation bar background picture If the height of the navigation bar, as if it seems difficult to adjust in iOS 8.0 ah, it is estimated only to form a good habit, the picture is standardized and then use.

    If the picture exceeds the height of the navigation bar, it runs below the status bar and cannot use the Statusbarstyle to reset the status bar, so the best way to do this is to fit the picture size    [ Self.navigationController.navigationBar setbackgroundimage:[uiimage imagenamed:@ "Big2.png"] forbarmetrics: Uibarmetricsdefault];    [UIApplication sharedapplication].statusbarstyle=uistatusbarstylelightcontent;


"iOS Dev-25" Uidevice View system Information, start with a question how to quickly find the properties and methods you want and understand it

Related Article

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.