4

I make an app that draws stuff to the exact physical dimensions. Like if it's 10mm then if you measure the image in the screen, it's 10mm across physically. This worked fine with iPhones up to the 5S because the screen DPI was the same on all of them, and when it doubled that didn't affect the math. You would just divide the amount of millimeters of size by 0.1558282 and that would give you the pixels wide that it needed to be :D

But on iOS 8 with AutoLayout, I added support for iPad. Now the images drawn on the screen using the old mm/0.1558282 ratio appear too large.

Is there a way to get the current screen pixel density (i.e. the DPI) as a property of something in iOS 8? If not then how do you determine it, given that new devices may come out with different DPIs soon, or people may be using iOS on their car's screen, etc.?

CommaToast
  • 11,370
  • 7
  • 54
  • 69
  • possible duplicate of [Get ppi of iPhone / iPad / iPod Touch at runtime](http://stackoverflow.com/questions/3860305/get-ppi-of-iphone-ipad-ipod-touch-at-runtime) – Guillaume Algis Apr 17 '15 at 23:11
  • Hi CommaToast, did you got any logic for conversion?. Please share it to me. – Harsha Dec 03 '19 at 06:28
  • Doesn't simply using points solve this, since they're a physical measurement? – User Nov 24 '20 at 14:53

0 Answers0