xcode 用于视网膜显示 iphone 的图像

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6136985/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:07:53  来源:igfitidea点击:

Images for retina display iphone

iphonexcodeinterface-builderiphone-4retina-display

提问by Neelesh

I have an working application which i have tested in my ipod touch. Everything works pretty fine.

我有一个工作应用程序,我已经在我的 ipod touch 上测试过了。一切都很好。

My tabbar icons and splash screen images are in a separate folder in my Resources folder

我的标签栏图标和闪屏图像位于我的资源文件夹中的单独文件夹中

Resources->images

Now, I know for iPhone4 i need to use 2x images.

现在,我知道对于 iPhone4,我需要使用 2x 图像。

My question is for support for iPhone4 all that i need to do is add 2x images in my images folder. For example if my splashscreen image is Default.png, I should add my 2x image as [email protected]in my images folder and iphone will use it automatically.?

我的问题是支持 iPhone4,我需要做的就是在我的图像文件夹中添加 2x 图像。例如,如果我的启动画面图像是Default.png,我应该在我的图像文件夹中添加我的 2x 图像作为[email protected]并且 iphone 将自动使用它。?

Is it the same for all tabbar images ?

所有标签栏图像都一样吗?

Thanks in advance

提前致谢

回答by BoltClock

Yes, all that you said is correct. Remember to also import the @2ximages into your Xcode project (e.g. by dragging them from Finder to Xcode), so they'll be added to the bundle when you build your app.

是的,你说的都是对的。记住还要将@2x图像导入您的 Xcode 项目(例如,通过将它们从 Finder 拖到 Xcode),以便在您构建应用程序时将它们添加到包中。

回答by Luke

For the apps I have worked on, I have only one image in this format:

对于我开发的应用程序,我只有一张这种格式的图像:

[email protected]

When I reference this image, I make the following call and it always works, whether on a 3GS/iPhone 4 or iPad.

当我参考这张图片时,我进行了以下调用,它始终有效,无论是在 3GS/iPhone 4 还是 iPad 上。

[UIImage imageNamed:@"myImage.png"]