xcode 了解 iPhone 分辨率
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8085553/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Understanding iPhone resolution
提问by Skylervich
I'm using phonegap to export a very simple html5 page to an iphone app and running into this silly issue.
我正在使用 phonegap 将一个非常简单的 html5 页面导出到 iphone 应用程序并遇到了这个愚蠢的问题。
iPhone resolution is 960x640.
iPhone 分辨率为 960x640。
When I set the canvas to those dimensions, it seems way too big.
当我将画布设置为这些尺寸时,它似乎太大了。
<canvas width="960" height="580" style="background-color:#607559"></canvas>
Why is that? And how can I utilize the full high definition capabilities of iphone4. It seems that canvas fits full-screen if I set the canvas to something of older iPhone(320×480).
这是为什么?以及如何利用 iphone4 的全高清功能。如果我将画布设置为较旧的 iPhone(320×480),则画布似乎适合全屏。
Setting viewport to something like this seems to work, but will this be a performance hit?
将视口设置为这样的东西似乎可行,但这会影响性能吗?
<meta name="viewport" content="width=device-width, height=device=height, initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, user-scalable=no" />
采纳答案by Daniel Kurka
It depends about which iphone you are talking about.
这取决于你说的是哪款 iphone。
The old iPhone 3GS has a resolution of 320x480. The newer iPhone 4 and iPhone 4s have the so called retina display, which has a resolution of 640x960, but it automatically scales up (you don`t access the pixels independently.
旧款 iPhone 3GS 的分辨率为 320x480。较新的 iPhone 4 和 iPhone 4s 具有所谓的视网膜显示屏,其分辨率为 640x960,但它会自动放大(您不能独立访问像素。
But you can set the device pixel ratio which is very good covered for canvas in this question: Canvas drawing and Retina display: doable?
但是您可以设置设备像素比,这在这个问题中很好地覆盖了画布:Canvas drawing and Retina display: doable?