iPhone 4 屏幕分辨率(按代码)?
我刚才顿悟了。 在我的第一个 iPhone 应用程序的某些地方,我对屏幕宽度和/或高度(320、460)进行了硬编码。
现在我意识到我从来没有注意到这一点,因为在 iPhone 4 模拟器中我没有注意到任何绘图问题。
那么这是否意味着 iPhone 4 在内部将 320 转换为其屏幕分辨率的任意宽度?我对此表示怀疑。但话又说回来,为什么我跑步时会看到一切看起来都很好呢?
例子: 如果我在位置 (320, 100) 绘制一个球,我可以清楚地看到它在屏幕的最右边缘绘制。
这是怎么回事?
I had an epiphany just now.
In some places in my very first iPhone app I have hardcoded values referring to the screen width and/or height (320, 460).
now I realize that i never noticed this because in the iPhone 4 simulator i dont notice any drawing issues.
So does this mean the iPhone 4 internally converts 320 to be whatever the width for its screen resolution? i doubt it. But then again, why would i be seeing everything appearing to be fine when i run?
Example:
If I make a ball draw at position (320, 100) I can clearly see that it is drawing at the far right edge of the screen.
What is going on here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,它不适应 iPhone 的标准 320 屏幕。它实际上使模拟器适应了 Mac 屏幕,使其更大。而关于球320是从左到右0---320,460是从上到下0----460。母猪将球放在 320,100 处应该将其放置在 fa 右侧。
No it does not adapt the screen it's standard 320 for the iphone. It actually adapts the simulator to the mac screen makes it bigger. And about the ball 320 is from left to right 0---320, and the 460 is from up to down 0----460. sow putting the ball at 320,100 should place it in the fa right.