如何将 Xcode 4.2 项目文件移动到另一个文件夹?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9245764/
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 23:17:30  来源:igfitidea点击:

How do you move an Xcode 4.2 project file to another folder?

xcodeprojects-and-solutions

提问by Mark A. Donohoe

Not crazy about the way Xcode 4.2 has laid out the files on disk. It creates a project file, then a single subfolder next to it that has all the code. We want the project file to be in that same folder, then the workspace file (if any) to be the folder's sibling. Makes for more portable layouts.

对 Xcode 4.2 在磁盘上布置文件的方式并不感到疯狂。它会创建一个项目文件,然后在它旁边创建一个包含所有代码的子文件夹。我们希望项目文件位于同一个文件夹中,然后工作区文件(如果有)是文件夹的同级文件。实现更便携的布局。

However, I can't STAND the lack of Save-as in Lion, and now, apparently Xcode 4.2 as well. At least with TextEdit I just grabbed the version from SL and it works. No such luck with Xcode as as you know, it's a completely different animal than Xcode 3.x.

但是,我无法忍受 Lion 中缺少 Save-as,现在显然 Xcode 4.2 也是如此。至少在 TextEdit 中,我只是从 SL 中获取了该版本并且它可以工作。正如您所知,Xcode 没有这么幸运,它与 Xcode 3.x 完全不同。

So... how does one move/rename the project file relative to the source code?

那么...如何相对于源代码移动/重命名项目文件?

回答by bentford

Here is how you do it (I'm using in Xcode 4.3):

这是您的操作方法(我在 Xcode 4.3 中使用):

First, move your project file
1. Start out by closing the Xcode project 1. Move ProjectName.xcodeproj into the folder with all your code
1. Open the XCode project by clicking ProjectName.xcodeproj

首先,移动您的项目文件
1. 首先关闭 Xcode 项目 1. 将 ProjectName.xcodeproj 移动到包含所有代码的文件夹中
1. 单击 ProjectName.xcodeproj 打开 XCode 项目

Second, re-map your files
1. You do not need to remap the files one by one, you only need to map the groups
1. Open the "File Inspector" with ??1 or View->Utilities->Show File Inspector
1. Click each group, then click the square icon (see screenshot below) and choose the folder your project file is in.

二、重新映射你的文件
1.你不需要一个一个地重新映射文​​件,你只需要映射组
1. 用 ??1 或View->Utilities->Show File Inspector
1打开“文件检查器” 。单击每个组,然后单击方形图标(见下面的截图)并选择你的项目文件所在的文件夹。

Icon to click: enter image description here

点击图标: 在此处输入图片说明

"None" will show up when you choose the same folder your .xcodeproj file is in.

当您选择 .xcodeproj 文件所在的同一文件夹时,将显示“无”。

Conclusion:
I have a large project which contains ~650 files, but only 12 groups, so it takes just a few minutes to re-map everything.

结论:
我有一个包含约 650 个文件的大型项目,但只有 12 个组,因此重新映射所有内容只需几分钟。

Note:
Sometimes when mapping the files it doesn't recognize a folder change if the name is the same (ie. two folders with the same name). You may have to pick any other folder temporarily, then choose the actual project folder and the Noneindicator will appear.

注意:
有时在映射文件时,如果名称相同(即两个文件夹名称相同),它无法识别文件夹更改。您可能需要临时选择任何其他文件夹,然后选择实际的项目文件夹,然后将出现“无”指示符。