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

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

问题描述

Apple展示了支持视网膜图形的新iPad。



我看到此链接视频图形在苹果应用程序中。正如你所看到的那样,苹果只需使用@ 2x后缀进行视网膜iPad显示。



我有一个通用的应用程序。那么如何在新的iPad iPhone中支持视网膜? iPad视网膜会使用类似于iPad的后缀@ 2x吗?

解决方案

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



因此对于没有视网膜的设备:

ImageName.png - 适用于iPhone / iPod

ImageName~ipad.png - 适用于iPad



适用于带视网膜显示器的设备:

ImageName@2x.png - 适用于iPhone / iPod

ImageName@2x~ipad.png - 适用于iPad



<如果您的iPhone高分辨率图像和iPad高分辨率图像具有相同的尺寸,您仍然可以使用@ 2x。

要加载图像,只需使用 [UIImage imageNamed:@ ImageName.png];

我刚刚在iOS模拟器上为iOS 5.1,5.0和4.3测试过它。

顺便提一下你的原因应该使用@ 2x,仅此而已。



主要是因为你不应该在iPhone和iPad上使用相同的图形,因为iPhone和iPad有d不一致的大小。如果您将使用相同尺寸的图形,您已经为iPad视网膜显示器(如果您以前使用iPhone视网膜显示器)。如果您将使用不同尺寸的图像,那么您将为iPhone和iPad使用不同的图像名称。所以在这方面你需要添加@ 2x后缀。
这就是你应该只使用@ 2x后缀的原因。 - 这些是我的想法。


Apple presented new iPad that support retina graphics.

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

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.

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

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

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.

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天全站免登陆