关于iPhone4屏幕分辨率
我从 http://www.apple.com/iphone/specs.html 读到iPhone4 的屏幕分辨率为 960 x 640 像素,ppi 为 326。
但是在Xcode的IPhone4.3模拟器中,当我操作显示对象时,打印[UIScreen mainScreen].applicationFrame,它是320*480。
那么,如果我想使用图片作为应用程序的主屏幕背景,我应该使用哪种尺寸? 640*960还是320*480?
或者我应该使用哪种图像?图像的大小会对细节产生很大影响。
I read from http://www.apple.com/iphone/specs.html that IPhone4's screen is 960-by-640-pixel resolution at 326 ppi.
But in Xcode's IPhone4.3 simulator, when I manipulate the display objects, print the [UIScreen mainScreen].applicationFrame, it is 320*480.
So if I wanna use a picture as the main screen's background of my app, which size I should use? 640*960 or 320*480?
Or Which kind of images should I use ? The size of images can affect the details a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以同时使用两者。
如果您想开发适用于 Retina Display (iPhone 4) 的应用程序,那么您应该使用双分辨率 (640x960) 的图像,然后,当您创建 UIImageView 时,将尺寸除以 2。
此外,您还可以选择名称中带有 @2x 的图像,例如
[电子邮件受保护]
(640x960)。在这种情况下,您不需要划分大小。使用这种方式:你的img var已经划分了大小,如果你部署到iPhone4它有Retina Display分辨率。
You can use both.
If you want to develop apps to Retina Display (iPhone 4), then you should use image with double resolution (640x960), then, when you create your UIImageView, you divide the size by 2.
Also, you have the option to have a image with @2x on its name, for example
[email protected]
(640x960). In this case, you don't need to divide the size. Using this way:Your img var has already divided the size, and if you deploy to iPhone4 it has Retina Display resolution.
您应该为相同的背景创建两个图像。
第一张图片 = background.png 尺寸 = 320x480
第二张图片 = [email protected] 尺寸 = 640x960
iPhone 将自动使用视网膜上的“@2x”图像 展示。
提示:创建此图像时,将图像创建为 640x960,然后在完成后将其大小调整一半。
注意:这对于所有图像都是相同的。按钮、图像、背景等。
You should create two images for the same background.
1st Image = background.png dimensions = 320x480
2nd Image = [email protected] dimensions = 640x960
The iphone will automatically use the "@2x" image with the retina display.
Tip: when creating this image, create the image as 640x960 and then just resize it by half when done.
Note: this works the same for ALL images. Button, images, backgrounds etc..
一个。(不是两者)
最好的做法是一个,因为您的应用程序包下载时会更小并且更容易在 XCode 中管理。始终创建适合视网膜像素显示大小的图像。
为什么?
即使屏幕分辨率不同,视网膜显示器和标准像素显示器也使用相同的点系统。例如,这就是为什么在 iPhone 上 - 当询问 window.frame.size.. - 返回 320X480,即使 iPhone 具有视网膜显示屏。 iOS 根据点网格放置图像,无论图像分辨率如何。该图像分辨率也可能能够处理标准或视网膜显示器。
因此,请始终创建适合视网膜像素显示大小的图像。
请随意打印定制的绘图纸(包含尺寸和常用组件)以帮助勾勒出您的视图(并非所有事情都应该以数字方式完成:D)。 http://achim.us/eli/iOS_Graph_Paper.pdf
One. (not both)
It is best practice to do one because your application bundle smaller on download and easier to manage in XCode. Always create images sized for retina pixel display.
Why?
Both retina and standard pixel displays use the same point system even with different screen resolutions. For example, this is why on iPhone - when asking the window.frame.size.. - returns 320X480, even when the iPhone has a retina display. iOS puts the image in place according to the point grid regardless of image resolution. That image resolution might as well be able to handle either standard or retina displays.
Therefore, always create images sized for retina pixel display.
Feel free to print out custom made graphing paper (with dimensions and commonly used components included) to help sketch out your views (not everything should be done digitally :D). http://achim.us/eli/iOS_Graph_Paper.pdf