iPhone 屏幕分辨率。 160 vs 163 vs 未来
我正在尝试制作一个以现实世界单位显示某些内容的应用程序。 它不是标尺应用程序,但它需要这种精度。
看起来 iPhone 和 iPod touch 具有不同的屏幕分辨率(分别为 160 和 163)
我发现了这个 计算 iPhone 上的像素大小 还有这个 未来硬件中的 iPhone 屏幕分辨率变化 还有这个 http://forums.macrumors.com/showthread.php?t=350612
从我的阅读看来,我可以将 320 * 480 的屏幕空间视为 2 * 3.5 英寸,忽略 iPod 和 iPhone 分辨率之间的差异,这似乎只影响图像的清晰度,而不影响尺寸。
我的问题是:这是真的吗?有什么方法可以在代码中确定这一点(320“像素”== 2英寸),所以如果它发生变化,我不必更新。
I'm trying to make an app that displays something in real-world units.
It's not a ruler app, but it wants that kind of precision.
It already looks like the iPhone and iPod touch have different screen resolutions (160 & 163 respectively)
I've found this
Calculating pixel size on an iPhone
and this
iPhone screen resolution changes in future hardware
and this
http://forums.macrumors.com/showthread.php?t=350612
From my reading it sounds like I can treat the 320 * 480 screen space as 2 * 3.5 inches, ignoring the difference between the iPod and the iPhone resolution, which only seems to affect the clarity of the image, not the size.
My question(s) are: is this true? any way to determine this (320 "pixels" == 2 inches) in code, so if it changes I don't have to update.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我现在不担心,如果苹果改变了它并且没有告诉他们的开发者,那么他们自己就会失去客户。现在只需对您的应用程序进行硬编码即可在该环境中工作。
PPI 不应该有什么不同,但所有其他应用程序都运行良好,苹果告诉我们要考虑的唯一硬件差异是麦克风、摄像头、互联网连接和电话功能。 (即使PPI不同,无论使用多少英寸,它仍然是320X480像素。)
I wouldn't worry about it for now, if Apple changed it and didn't tell their developers then they would lose customers themselves. Just hard code your app to work in this environment for now.
The PPI shouldn't be different, but all other apps run fine and the only hardware differences Apple tells us to account for are microphone, camera, Internet connection, and phone-ness. (Even if the PPI is different, it's still 320X480 pixels no matter how many inches are used.)
参考声称的问题:
这种说法是错误的。屏幕尺寸为2:3比例。 对角线为 3.5 英寸。
使用 3.5 英寸对角线并使用 2:3 比例,计算得出的屏幕尺寸大致为 1.94 * 2.91 英寸。
它确实是320 * 480。只是不是2英寸乘3.5英寸,甚至不是2英寸乘3英寸。显示屏尺寸略小于 2 英寸 x 3 英寸。这就是为什么它可以是 320 * 480 而不是 160 ppi。 (或者 iPhone 4 的分辨率为 640 x 960 而不是 320 ppi)。
Reference the question which claims:
That claim is wrong. The screen size is a 2:3 ratio. The diagonal is 3.5 inches.
Using a 3.5 inch diagonal and using the 2:3 ratio, a calculation gives approximate screen dimensions of 1.94 * 2.91 inches.
It really is 320 * 480. It just is not 2 inches by 3.5 inches, nor even 2 inches by 3 inches. The display is a just a bit smaller than 2 inches by 3 inches. That is why it can be 320 * 480 and not be 160 ppi. (Or be 640 x 960 and not be 320 ppi with the iPhone 4).
如果您了解如何计算 ppi,您需要知道广告中的屏幕尺寸(以英寸为单位)。我相信您可以安全地处理 [[UIScreen mainScreen] 边界],正如 JoePasq 所说。您可以为自己设置一个您认为英寸的常量,并使用边界的宽度和高度来表示您的测量值。如果您的应用程序确实更改了屏幕尺寸,这将允许您的应用程序进行缩放。
If you look how you calculate ppi, you need to know the advertised screen size in inches. I believe you are safe to deal with [[UIScreen mainScreen] bounds] as JoePasq said. You can set a const of what you think an inch is for yourself and use the width and height of the bounds to represent your measurement. This will allow you app to scale if they ever do change the size of the screen.