What are pixels and points in iOS?

前端 未结 3 1079
攒了一身酷
攒了一身酷 2020-11-29 00:41

from UIImage reference:

@property(nonatomic, readonly) CGSize size

The dimensions of the image, taking orientation into account.

3条回答
  •  没有蜡笔的小新
    2020-11-29 01:04

    Using data from http://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions I set up the formula sqrt(pointWidth^2+pointHeight^2)/diagonalInches to figure out how many points each phone displayed per inch.

    Results:

    • iPhone 2G, 3G, 3GS, 4, 4s = 164.825201164068082 Points Per Inch

    • iPhone 5, 5s = 162.9846618550346903

    • iPhone 6 = 162.8061416117083255

    • iPhone 6 Plus = 153.535954278463216

    As you can tell a point is roughly the same size on each phone. Using the same webopage, you can set up the same formula with the pixel values, and you'll notice large irregularities due to higher pixel densities on the newer phones.

提交回复
热议问题