标尺应用如何在所有设备上保持准确? [英] How do ruler apps stay accurate on all devices?

查看:99
本文介绍了标尺应用如何在所有设备上保持准确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很困惑目前市场上的iOS Ruler应用程序与不同尺寸的设备兼容。一个例子显示在底部。

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.

经过研究,我得出的结论是,实时获取当前屏幕的PPI是不可能的,这使得它无法以编程方式绘制标尺。

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.

我的查询是这些标尺应用程序如何准确显示标尺而无法获取设备PPI?

我首先想到的是每个设备的PPI和屏幕尺寸都硬编码到应用程序中。这似乎需要付出很多努力才能解决百万错误。这真的是他们必须这样做的吗?需要在每个不同的设备上进行测试,以确保其正常工作。我只能访问我的iPhone 5S。他们可能会为每个不同的设备提供不同的统治者图像吗?这将占用手机上的大量空间。

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.

我看到有关绘图统治者的类似问题,但(如果我错了,请纠正我)他们似乎没有一个解决方案来保持不同屏幕尺寸和PPI的准确性。他们似乎都说这是不可能的。如果不可能,它是如何完成的?

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?

推荐答案

正如您所发现的,iOS没有公共API来获取设备的PPI。

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

正如你推测的那样,这些应用程序可能有一个硬编码列表。有不到一百个硬件设备ID(参见此列表,例如),只有少数不同的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:


  • 非视网膜iPhone,iPod touch,和iPad mini:163 PPI

  • 视网膜iPhone(6+除外),iPod touch和iPad mini:326 PPI

  • iPhone 6+:401 PPI

  • 非视网膜iPad:132 PPI

  • 视网膜iPad:264 PPI

  • 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

我猜这些应用程序的制造商通常会使用每台设备测试他们的应用程序。除非您检查了应用程序,否则您没有理由认为应用程序比上面列出的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.

要检测iOS设备类型,查看此问题的答案

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

这篇关于标尺应用如何在所有设备上保持准确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆