在 Xcode 4 中将文件添加到单独的目标

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

Adding files to separate targets in Xcode 4

iphoneobjective-cxcodexcode4targets

提问by Smikey

Since upgrading to xcode 4, I can't find where to specify what Target a resource belongs to. Previously, I selected the file and hit command+i, but this now seems to run the program, rather than bring up the info box for that file.

升级到 xcode 4 后,我找不到指定资源所属的 Target 的位置。以前,我选择了文件并点击 command+i,但现在这似乎运行了程序,而不是打开该文件的信息框。

回答by Walter

Select the project file in the document explorer. On the Right margin of the Xcode window make sure to display the right drawer view if it isn't already there (it usually has Object library and Quick Help). In the top margin, click on the icon that looks like a document (rather than the one with the waves that is quick help). The target membership and the other info from the old Get Info command is there. enter image description here

在文档资源管理器中选择项目文件。在 Xcode 窗口的右边距上确保显示正确的抽屉视图(如果它不存在的话)(它通常有对象库和快速帮助)。在顶部空白处,单击看起来像文档的图标(而不是带有快速帮助的波浪形图标)。来自旧的获取信息命令的目标成员资格和其他信息就在那里。 在此处输入图片说明

回答by Michael Behan

Select the project file in the document explorer pane, select your target from the list, select the build phases tab and add/remove your resources in the copy bundle resources phase or source code in the compile sources phase.

在文档资源管理器窗格中选择项目文件,从列表中选择您的目标,选择构建阶段选项卡并在复制捆绑资源阶段添加/删除您的资源或在编译源代码阶段添加/删除您的资源。

回答by avide

Right click on a folder (eg. resource) on the document explorer (which is the left column with all your files and folders in your project), select Add Files to "Project Name". Below you will see check boxes that determine the file's association with each target.

右键单击文档资源管理器(包含项目中所有文件和文件夹的左侧列)上的文件夹(例如资源),选择将文件添加到“项目名称”。您将在下方看到确定文件与每个目标的关联的复选框。

@makdad - This also works for the 'blue folder' situation.

@makdad - 这也适用于“蓝色文件夹”的情况。

Note: if you already have a file in xcode, the only way you can add targets to a file that's in a 'blue folder' is to remove the file and follow the steps stated above.

注意:如果您已经在 xcode 中有一个文件,那么您可以将目标添加到“蓝色文件夹”中的文件的唯一方法是删除该文件并按照上述步骤操作。