简体   繁体   中英

Why is the size of screen of my iPhone XR 375 × 812?

print(UIScreen.main.currentMode?.size) // 750 * 1624
print(UIScreen.main.bounds.size) // 375 * 812
print(UIScreen.main.nativeBounds) // 828 * 1792

I use launch storyboard.

From Apple Documentation

UIScreen.main. nativeBounds : The bounding rectangle of the physical screen, measured in pixels.

UIScreen.main. bounds : The bounding rectangle of the screen, measured in points.

UIScreen.main.bounds. size The screen size, measured in pixels.

Pixels vs Points from here

A pixel on iOS is the full resolution of the device, which means if I have an image that is 100x100 pixels in length, then the phone will render it 100x100 pixels on a standard non-retina device. However, because newer iPhones have a quadrupled pixel density, that same image will render at 100x100 pixels, but look half that size. The iOS engineers solved this a long time ago (way back in OS X with Quartz) when they introduced Core Graphics' point system. A point is a standard length equivalent to 1x1 pixels on a non-retina device, and 2x2 pixels on a retina device. That way, your 100x100 image will render twice the size on a retina device and basically normalize what the user sees.

It also provides a standard system of measurement on iOS devices because no matter how the pixel density changes, there have always been 320x480 points on an iPhone screen and 768x1024 points on an iPad screen.*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM