What is the unit of measurement in Xcode

前端 未结 3 1873
盖世英雄少女心
盖世英雄少女心 2021-01-31 10:35

This might sound silly but when i\'m working with sizes in Xcode, the total frame size is equal to 320 * 568 ( width * height ). I\'m fine with that. But the resolution of the p

3条回答
  •  心在旅途
    2021-01-31 11:06

    Xcode 10.1, Swift 4.2 answer

    Xcode uses points. But in case of next explanation what is point and how much pixels in point -> it depends what retina device are you using. Basicaly on non-retina devices 1 point = 1pixel. On iphone 6plus and newer "plus" models, apple added 3x resolution.

    On normal retina devices 1 point = 4 pixels, NOT 2!! then apple packing that pixels into point. At iPhone plus models apple also uses downsampling with factor 1.15 which means for example, if you have 1242*2208 then it should be devided on 1.15 and you get your 1080*1920 fullHD on your device. https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions

    I believe that the top answer, which is:

    It uses points. In retina devices, 1 point equals two pixels. In non-retina devices, 1 points equals 1 pixel.

    is wrong because of outdate. I provided a link to developer.apple.com.

    https://developer.apple.com/documentation/uikit/uiscreen/1617836-scale

提交回复
热议问题