Xcode 4.x 将新项目添加到工作区
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11021514/
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.x adding new Project to a Workspace
提问by Chris G.
One would think that adding a project to a Workspace in Xcode would be intuitive.
有人会认为在 Xcode 中将项目添加到工作区会很直观。
1) But when you add a new project it is added within the existing project - It must be a bug, or is there actually a reason.
1)但是当您添加一个新项目时,它会添加到现有项目中 - 这一定是一个错误,或者实际上是有原因的。
2) How do you add a project then (ctr + right click et.)
2)然后如何添加项目(ctr +右键单击等)
回答by Sangcheol Choi
You could use the plus (+) button on the lower left corner of Xcode IDE to add a new project to a workspace. You must have first a blank workspace, which you could use the menu (New/Workspaceswith short cuts ^%N).
您可以使用 Xcode IDE 左下角的加号 (+) 按钮将新项目添加到工作区。您必须首先有一个空白工作区,您可以使用该菜单(新建/带有快捷方式的工作区^%N)。
回答by rptwsthi
To morning I spend some time doing what you asked to. so here are the steps (you can skip if you already have followed some).
到早上我花了一些时间做你要求的事情。所以这里是步骤(如果你已经遵循了一些,你可以跳过)。
- Create a new blank work space
- Add a project to it by clicking File->Add new files to "Your workSpace" or "command+option+A"
- Choose your project folder Or yourproject.xcodeproj file
- 创建一个新的空白工作空间
- 通过单击“文件”->“将新文件添加到“您的工作区”或“命令+选项+A”向其中添加项目
- 选择你的项目文件夹或者你的project.xcodeproj文件
Just let the indexing finish properly, and congratulations you have added a new project to your xcode work space successfully.
只需让索引正确完成即可,恭喜您已成功将新项目添加到 xcode 工作空间。
Note:Make sure that project which you are adding is not already opened, Xcode get lil sensitive about that and doesn't show files tree in workspace in that case.
注意:确保您添加的项目尚未打开,Xcode 对此非常敏感,并且在这种情况下不会在工作区中显示文件树。
回答by Eric apRhys
My answer pertains to XCode 5, but should pertain to XCode 4 as well.
我的答案适用于 XCode 5,但也应该适用于 XCode 4。
In typical Apple fashion, they have given you multiple ways to do the almostthe same thing. Very confusing and annoying. There are three ways, and only one way pertains to the original posters question:
以典型的 Apple 方式,他们为您提供了多种方法来做几乎相同的事情。非常混乱和烦人。共有三种方式,只有一种方式与原始海报问题有关:
(1) Use File --> Add Files to ... Problem with this, is that it will only add files to workspace if NO project has been selected. Problem with THAT, is that once you select a project, there is no way I know of to unselect it.
(1) 使用 File --> Add Files to ... 这个问题是,如果没有选择项目,它只会将文件添加到工作区。问题在于,一旦您选择了一个项目,我就无法取消选择它。
(2) Use the "+" in the lower-left corner. Problem with that, it is equivalent to using the pull down menu (#1 above)
(2) 使用左下角的“+”。问题在于,它相当于使用下拉菜单(上面的#1)
(3) Right click in the left pane (in an empty area), and you will see "Add files to " This is the only right way to do it, as it guarantees that the file will be added to the workspace, and not any selected project.
(3) 在左窗格中(在空白区域)右键单击,您将看到“将文件添加到”这是唯一正确的方法,因为它保证文件将添加到工作区中,而不是任何选定的项目。
Try all three methods after selecting an existing project, and you will see what I mean.
选择现有项目后尝试所有三种方法,您就会明白我的意思。
Based on my previous experience with XCode, Apple will take about 10 more years to fix this sort of thing.
根据我之前使用 XCode 的经验,Apple 还需要大约 10 年的时间来修复此类问题。
回答by Peter Meier
One would think that adding a project to a Workspace in Xcode would be intuitive.
有人会认为在 Xcode 中将项目添加到工作区会很直观。
Of course not, this is Apple, only usable for certain experts...
当然不是,这是苹果,仅供某些专家使用......
1) But when you add a new project it is added within the existing project - It must be a bug, or is there actually a reason
1)但是当您添加一个新项目时,它会添加到现有项目中 - 这一定是一个错误,或者实际上是有原因的
You did miss the drop down selection list "Add to:" in the last of three dialog pages, the place where the location of the .xcodeproj file is specified. There you can select the Workspace you are currently using. So simply use "File" "New..." "Project...", give it a name and select from templates, and NEVER intuitiveley double click on the directory where to place the project file, but be sure to adjust the selection drop down list to your currently open workspace. Of course this choice is never preselected.
您确实错过了三个对话框页面中最后一个中的下拉选择列表“添加到:”,这是指定 .xcodeproj 文件位置的位置。您可以在那里选择您当前使用的工作区。所以只需使用“文件”“新建...”“项目...”,给它一个名字并从模板中选择,永远不要直观地双击放置项目文件的目录,但一定要调整选择下拉列表到您当前打开的工作区。当然,这个选择永远不会被预先选择。