http://www.dorapro.co.jp/engineerblog/?p=255
iPhone 6 Plus/iPhone 6s Plus 5.5 inch 1920 x 1080 16:9
onI want to get the screen resolution as terminal information by Swift, but I don't know how to get it.
Please let me know
ios swift objective-c
The iPhone 6 Plus returns a value of 1080x1920 in the UISscreen.nativeBounds
property.
print (UISscreen.mainScreen().nativeBounds)
If you run the above on an iPhone 6 Plus device,
(0.0, 0.0, 1080.0, 1920.0)
returns the .
The resolution (2208.0 121242.0) can be obtained by the following process, but the iPhone 6 Plus seems to be a little special, so the 1920x1080 value cannot be obtained.
let size=UISscreen.mainScreen().bounds.size
let scale = UISscreen.mainScreen().scale
let result = CGSizeMake (size.width*scale, size.height*scale)
print(result.height)//2208.0
print(result.width)//1242.0
↓Reference URL
http://qiita.com/YukiAsu/items/78a5bed63c12660e8024
© 2024 OneMinuteCode. All rights reserved.