Xcode 4:从项目中删除文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13795009/
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: Remove Files From Project?
提问by jww
How does one remove files from a Xcode Project? I'm having troubles by pressing "Delete" and then selecting "Remove References".
如何从 Xcode 项目中删除文件?我在按“删除”然后选择“删除引用”时遇到了麻烦。
I ask because I moved a bunch of PNGs from <root>
to <root>/icons/
(after creating the icons
subdirectory). I removed the PNGs from the project, and then re-added the PNGs under the new location. I also added an "icons" folder under "Resources" in Xcode. It results in CopyPNG failures due to the old path.
我问是因为我从<root>
to移动了一堆 PNG <root>/icons/
(在创建icons
子目录之后)。我从项目中删除了 PNG,然后在新位置下重新添加了 PNG。我还在 Xcode 的“Resources”下添加了一个“icons”文件夹。由于旧路径,它会导致 CopyPNG 失败。
Some testing revealed that Xcode does not remove the references in the PBXPROJ file. Which begs the question, what exactly am I removing from the project if a reference remains? It also begs, how do I truly expunge the data from the project so I can cleanly add it again?
一些测试表明 Xcode 不会删除 PBXPROJ 文件中的引用。这就引出了一个问题,如果引用仍然存在,我究竟要从项目中删除什么?它还乞求,我如何真正从项目中删除数据,以便我可以干净地再次添加它?
Jeff
杰夫
回答by Shamsudheen TK
Here are my thoughts..
这是我的想法..
1. Right-click the file --> Delete --> RemoveReference
1.右击文件-->删除-->RemoveReference
It will remove only the linked referencefrom your project.The files will not be deleted. They will exist in the project folder. When you require the file again , just browse the files from the project folder and add to your project. Note that "Copy items into the destination group's folder" option should be unchecked.
它只会从您的项目中删除链接的引用。文件不会被删除。它们将存在于项目文件夹中。当您再次需要该文件时,只需浏览项目文件夹中的文件并将其添加到您的项目中即可。请注意,应取消选中“将项目复制到目标组的文件夹”选项。
2. Right-click the file --> Delete --> Move To Trash
2. 右键单击文件--> 删除--> 移至废纸篓
It will remove all the files and linked referencefrom your project. When you require the file again , you have to browse the files from its downloaded/original location and add to your project.Note that "Copy items into the destination group's folder"option should be checked.
它将从您的项目中删除所有文件和链接引用。当您再次需要该文件时,您必须从其下载/原始位置浏览文件并将其添加到您的项目中。请注意,应选中“将项目复制到目标组的文件夹中”选项。
回答by Ajeet
You click on your project then right click on mouse select show in finder then remove from it png images or files.Then come on xcode and drag from images in selected folder.It will work......
您单击您的项目,然后右键单击鼠标选择在 finder 中显示,然后从中删除 png 图像或文件。然后在 xcode 上从所选文件夹中的图像中拖动。它会工作......
回答by Undo
There is another option, beside Remove References. Click it. This will completely remove the file from your app, including references. I can't seem to come up with a situation in my experiences where I needed to just remoe references.
除了删除引用之外,还有另一个选项。点击它。这将从您的应用程序中完全删除文件,包括引用。在我的经历中,我似乎无法想出我只需要重新引用引用的情况。
If you only remove references, the file will disappear from your Xcode project window, but it will still exist in the file system. This causes problems when copying another file in under the same name.
如果您只删除引用,该文件将从您的 Xcode 项目窗口中消失,但它仍会存在于文件系统中。这会导致在以相同名称复制另一个文件时出现问题。