Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do ruler apps stay accurate on all devices?

I'm really confused as to how iOS Ruler apps currently on the market are compatible with different size devices. An example is shown at the bottom.

After researching, I had come to the conclusion that getting the PPI of the current screen in realtime was impossible, which makes it impossible to programmatically draw a ruler.

My query is how do these ruler apps accurately display a ruler without being able to get the device PPI?

My first thought would be that the PPI and screen size for each device is hard-coded into the app. This seems like a lot of effort and a recipe for a million mistakes. Is this really how they have to do it? It would need to be tested on each different device to ensure it works correctly. I only have access to my iPhone 5S. Might they have different images of rulers for each different device? This would take up a lot of space on the phone.

I've seen similar questions on SO about drawing rulers, but (correct me if I'm wrong) they don't seem to have a solution for maintaining accuracy for different screen sizes and PPI. They all seem to say "it's impossible". If it's impossible, how is it done?

example

like image 305
Invalid Memory Avatar asked Feb 18 '15 00:02

Invalid Memory


People also ask

Are ruler apps accurate?

Like most (but not all) measuring apps, Apple's Measure is not designed for precision measurements: while we've found it to be pretty accurate for measuring physical objects and the odd child, it's not as accurate as the laser measures or good old-fashioned tape measures that professional tradespeople use.

What iPhone app has a ruler?

The Measure app uses augmented reality (AR) technology to turn your device into a tape measure. You can gauge the size of objects, automatically detect the dimensions of rectangular objects, and save a photo of the measurement.

Does IPAD have a ruler?

You can show a ruler at the top of the screen to set paragraph margins, set tab stops, and help position text boxes and other objects.


1 Answers

As you have discovered, iOS has no public API for getting the device's PPI.

These apps probably have a hardcoded list, as you speculated. There are under a hundred hardware device ids (see this list for example), and only a handful of different PPIs:

  • non-retina iPhone, iPod touch, and iPad mini: 163 PPI
  • retina iPhone (except 6+), iPod touch, and iPad mini: 326 PPI
  • iPhone 6+: 401 PPI
  • non-retina iPad: 132 PPI
  • retina iPad: 264 PPI

I'd guess the makers of these apps don't usually test their apps with every device. And unless you've checked the apps, there's no reason you should believe the apps are more accurate than the PPIs listed above.

To detect the iOS device type, check the answers to this question.

like image 88
rob mayoff Avatar answered Oct 22 '22 08:10

rob mayoff