iPhone 设计 - 管理多个版本

发布于 2024-11-02 22:02:36 字数 123 浏览 0 评论 0原文

我注意到 iPhone 3+ 的屏幕分辨率是 240x480,而 iPhone 4 的屏幕分辨率是 640x960 ...

这是否意味着您想要 2 组使用额外分辨率的图形?我的第一个想法是分辨率越高,图形显示的越小。

I notice that the screen resolution for the iPhone 3+ is 240x480 and the iPhone 4 is 640x960 ...

Does this mean that you'd want to have 2 sets of graphics that utilize the extra resolution? My first thought on that would be that the higher the resolution, the smaller the graphics would appear.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鼻尖触碰 2024-11-09 22:02:36

您确实需要两组图形。较旧的 iPhone 实际上是 320x480。一般来说,如果您愿意,您可以仅提供低分辨率图形,并且它会自动放大,但仅提供高分辨率图形不会自动工作。第二个图形的处理是根据文件名自动完成的,因此您将拥有一个名为 mygraphic.png 的文件和一个名为 [电子邮件受保护]。由于新屏幕的分辨率是旧屏幕的两倍,因此除了放置第二个文件之外,您无需执行任何特殊操作即可使其正常工作。

You do need two sets of graphics. The older iPhones are actually 320x480. In general you can provide only a low resolution graphic if you'd like, and it will be automatically upscaled, but going only one high resolution graphic doesn't work automatically. The handling of the second graphic is done automatically, based on filename, so you would have one file named mygraphic.png, and a second named [email protected]. Since the new screen is exactly double the resolution of the old screen, you don't need to do anything special to get it working beyond having the second file in place.

终陌 2024-11-09 22:02:36

正如 Sam 所概述的,UIImage 将根据文件名中是否存在 @2x 自动加载适当缩放的文件。但是,您也可以通过调用 [[UIScreen mainScreen] scale] 直接访问屏幕比例 - 这将在视网膜设备上返回 21 > 在较旧的 320x480 设备上。当使用 Core Graphics 绘制或修改图像等时,您可以使用比例值从网络上获取更高分辨率的图像。

As Sam outlined, UIImage will automatically load the appropriately scaled file based on presence of @2x in the filename. However, you can also access the screen scale directly by calling [[UIScreen mainScreen] scale] -- this will return 2 on retina devices and 1 on older 320x480 devices. You can use the scale value to pull down higher resolution images from the web, when drawing or modifying images with Core Graphics, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文