Xcode 4 将图像添加到项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7739258/
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
Xcode 4 adding images to a project
提问by Full Time Skeleton
Coming from a background of Visual Studio I had no idea how good that IDE truly was until I had to work with Xcode. One of the more pressing oddities that it has just thrown up is the following.
来自 Visual Studio 的背景,在我不得不使用 Xcode 之前,我不知道 IDE 到底有多好。它刚刚抛出的更紧迫的怪事之一如下。
I'm upgrading a project to a retina display and so have to add a bunch of new @X2 files. This is fine, I have the files and I go into Xcode, choose the project group where I want to add them, select them all and click 'Add'.
我正在将一个项目升级到视网膜显示器,因此必须添加一堆新的 @X2 文件。这很好,我有文件,然后进入 Xcode,选择要添加它们的项目组,将它们全部选中并单击“添加”。
"Multiple errors occured" Xcode helpfully blurts and then returns to whatever it was doing before. No break down of what those errors might be, or what actually happened or why.
“发生多个错误” Xcode 脱口而出,然后返回到它之前所做的任何事情。没有分解这些错误可能是什么,或者实际发生了什么或为什么。
So I do some looking and some of the files are actually in the directory but Xcode ignores them, I can't figure out a way of adding them (it says they're already there!) but they won't appear in the xcode project.
所以我做了一些查找,有些文件实际上在目录中,但 Xcode 忽略了它们,我想不出添加它们的方法(它说它们已经存在了!)但它们不会出现在 xcode 中项目。
Can I 'refresh' xcode so it looks in the directory and shows them?
我可以“刷新”xcode 以便它在目录中查找并显示它们吗?
==============================
==============================
PS. While I'm here and can rant a little, anyone with a VS background now using Xcode, am I wrong in thinking the following points are hugely annoying:
附注。虽然我在这里并且可以咆哮一点,但现在使用 Xcode 的任何具有 VS 背景的人,我认为以下几点非常烦人是错误的:
1) The debugger - frustratingly slow.
1) 调试器——慢得令人沮丧。
2) The file explorer - can't easily sort by name
2) 文件浏览器 - 无法轻松按名称排序
3) The file explorer - column on the right listing the file names doesn't change the file highlight when you move from file to file within the editor window.
3) 当您在编辑器窗口中从文件移动到文件时,文件资源管理器 - 右侧列出文件名的列不会更改文件突出显示。
4) Adding files to a project - see above!
4) 向项目添加文件 - 见上文!
Some of these probably stem from lack of experience with the IDE but still, they irk.
其中一些可能源于缺乏使用 IDE 的经验,但仍然令人厌烦。
回答by Chris Grant
Files in the XCode directories don't necessarily have to be in the project.
XCode 目录中的文件不一定必须在项目中。
For some reason, XCode doesn't like overwriting files, and that's the warning message that I usually get when this happens too - "Multiple errors occured."
出于某种原因,XCode 不喜欢覆盖文件,这也是我通常在发生这种情况时收到的警告消息 - “发生多个错误。”
What I suggest you do is remove all of the @2x files from your project directory, and add them back into XCode using "Add Files..." Make sure you select "Copy files into project directory if necessary" though, otherwise they will just be referenced to their current location on disk.
我建议您从项目目录中删除所有@2x 文件,然后使用“添加文件...”将它们重新添加到 XCode 中,但请确保选择“必要时将文件复制到项目目录中”,否则它们将只是被引用到它们在磁盘上的当前位置。