如何在通用应用程序中同时支持 iPad 和 iPhone 视网膜图形 [英] How to support both iPad and iPhone retina graphics in universal apps

查看:30
本文介绍了如何在通用应用程序中同时支持 iPad 和 iPhone 视网膜图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple 推出了支持视网膜图形的新 iPad.

Apple presented new iPad that support retina graphics.

我看到了 苹果应用中的这个链接视网膜图形.正如你所看到的,苹果在视网膜 iPad 显示器上只使用@2x"后缀.

I saw this link retina graphic in apple apps. As you can see apple just use "@2x" suffix for retina iPad display.

我有一个通用应用.那么如何在新的 iPad iPhone 中支持 Retina?iPad Retina 会使用类似于 iPad 的后缀@2x"吗?

I have an universal app. So how to support retina in new iPad and iPhone? Will iPad retina use suffix "@2x" similar to iPad?

推荐答案

我刚刚创建了一个测试应用并进行了测试.

I just created a test app and tested.

对于没有视网膜的设备:
ImageName.png - 适用于 iPhone/iPod
ImageName~ipad.png -- 对于 iPad

So for devices without retina:
ImageName.png - For iPhone/iPod
ImageName~ipad.png -- For iPad

对于配备 Retina 显示屏的设备:
ImageName@2x.png - 适用于 iPhone/iPod
ImageName@2x~ipad.png -- 对于 iPad

For devices with retina display:
ImageName@2x.png - For iPhone/iPod
ImageName@2x~ipad.png -- For iPad

如果您的 iPhone 高分辨率图像和 iPad 高分辨率图像大小相同,您仍然可以使用 @2x.
要加载图像只需使用 [UIImage imageNamed:@"ImageName.png"];
我刚刚在 iOS 5.1、5.0 和 4.3 的 iOS 模拟器上对其进行了测试.
顺便说一下,为什么你应该使用 @2x 而不是更多.

And you can still use @2x if your iPhone high resolution image and iPad high resolution image have the same size.
To load the image just use [UIImage imageNamed:@"ImageName.png"];
I just tested it on iOS simulator for iOS 5.1, 5.0 and 4.3.
By the way why you should use @2x and nothing more.

最重要的是,您不应该在 iPhone 和 iPad 上使用相同的图形,因为 iPhone 和 iPad 的尺寸不同.如果您将使用相同尺寸的图形,则 iPad 视网膜显示已经完成(如果您以前使用 iPhone 视网膜显示).如果您要使用不同尺寸的图像,那么您将为 iPhone 和 iPad 使用不同的图像名称.所以在这一边你只需要添加@2x 后缀.这就是为什么你应该只使用@2x 后缀的原因.- 这是我的想法.

The main thing because you shouldn't use the same graphics on iPhone and iPad, because iPhone and iPad has different size. And if you will use the same size the graphics will already done for you iPad retina display (if you previously use iPhone retina display). If you will images with different size, so you will use different image names for iPhone and iPad. So in this side you need just add @2x suffix. That's why you should use just @2x suffix. - these are my thoughts.

这篇关于如何在通用应用程序中同时支持 iPad 和 iPhone 视网膜图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆