简体   繁体   English

当我创建一个基于iphone窗口的应用程序时,如何告诉界面生成器创建视网膜像素大小的窗口?

[英]When I create an iphone window based app, how to tell interface builder create window for retina pixel size?

I hope to create an iphone window based app for retina screen? 我希望为视网膜屏幕创建一个基于iphone窗口的应用程序吗? But I found that the size of window in mainwindow.xib is fixed. 但是我发现mainwindow.xib中窗口的大小是固定的。 How to adjust it or there is any to tell interface builder create window for retina pixel size? 如何调整它,或者有什么可以告诉界面生成器创建视网膜像素大小的窗口?

Welcome any comment 欢迎任何评论

Thanks 谢谢

interdev InterDev中

There's no need to do anything in terms of the various components you layout in Interface Builder, as it's based around points, not pixels - and as all the iPhone screens sizes are the same in points no action is required. 对于在Interface Builder中进行布局的各种组件,无需做任何事情,因为它基于点而不是像素-并且所有iPhone屏幕的大小都相同,因此无需采取任何措施。

In terms of any images you're loading, you will need to supply higher resolution (twice the pixel size) versions, but as long as these are named "[original name]@2x.[extension]" they'll simply work automatically. 对于要加载的任何图像,您都需要提供更高的分辨率(像素大小的两倍),但是只要这些文件名为“ [原始名称] @ 2x。[扩展名]”,它们就会自动工作。

For more information on the image naming, see the "Specifying High-Resolution Images in iOS" section of the Resource Programming Guide and if you want to delve a little deeper, there's a discussion on "Points Versus Pixels" within the Drawing and Printing Guide for iOS . 有关图像命名的更多信息,请参见《 资源编程指南 》中的“在iOS中指定高分辨率图像”部分,如果您想更深入地研究,则在“ 绘图和打印指南 ”中有关于“点对像素”的讨论。 适用于iOS

UPDATE - As of the iPhone 5, the iPhone screens are no longer all the same point size. 更新 -从iPhone 5开始,iPhone屏幕不再具有相同的磅值。 :-) :-)

The window will be automatically resized for you, you do need concern about the size of your image elements, since retina display uses a bigger size of resolution. 该窗口将自动为您调整大小,您确实需要担心图像元素的大小,因为视网膜显示使用更大的分辨率。 You need name your images like this: 您需要像这样命名图像:

regular image name: myimage.png
retina image name:  myimage@2x.png

When running in an iPhone4 your program will identify the token "@2x" and change the images for that kind of device. 在iPhone4上运行时,您的程序将识别令牌“ @ 2x”并更改该设备的图像。

Design your layout using the size of: 640x960 (double of the original: 320x480) 使用以下尺寸设计布局:640x960(原始尺寸的两倍:320x480)

Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM