将资源文件添加到 xcode

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

Adding resource files to xcode

xcoderesources

提问by dole doug

I'm trying to add some new resource files to a project which was build by another person on another mac. I think that the project has the provision of the previous person.

我正在尝试将一些新的资源文件添加到另一个人在另一台 mac 上构建的项目中。我认为该项目有前人的规定。

Using right click->Add Files to "MyProject" doesn't provide the expected result. After I compile the project, the added file is not visible in the application.

使用右键单击->将文件添加到“MyProject”不会提供预期的结果。编译项目后,添加的文件在应用程序中不可见。

How can I add new resources in my project?

如何在我的项目中添加新资源?

PS: I'm trying to learn Objective-Cin a macincloud.comaccount.

PS:我正在尝试Objective-Cmacincloud.com帐户中学习。

回答by Paul Peelen

It might be that the file you added was not added to the project build. Click your project> App target> Build PhasesAnd check that the file exists in Compile sources(if it needs to be compiled), otherwise check Copy bundle resources. If the file does not exist there, drag it there and it should be fine, (from what I understand of your question).

可能是您添加的文件未添加到项目构建中。点击你的project> App target> Build Phases,并检查文件中是否存在Compile sources(如果需要编译),否则检查Copy bundle resources。如果该文件在那里不存在,请将其拖到那里,它应该没问题(根据我对您的问题的理解)。

EDIT

编辑

You can also check wether a file is added to the target by clicking the file and opening the "File Inspector" (View> Utilities> Show File Inspector, or ?+ ?+ 1), and check the Target Membershipsection.

你也可以请检查是否一个文件被点击该文件,并打开“文件检查器”(添加到目标View> Utilities> Show File Inspector,或?+ ?+ 1),并检查Target Membership部分。

Example:
Example

例子:
例子

回答by nanospeck

Adding to Copy bundle resourcesworked for me

添加到Copy bundle resources对我来说有效

enter image description here

在此处输入图片说明

回答by vpathak

Just drag the resource file (from a finder window) into your project files area (left side) and drop in supporting files.

只需将资源文件(从查找器窗口)拖到项目文件区域(左侧)并放入支持文件即可。

Once you drop, a dialog will prompt you which targets to add it for. Select all that are appropriate. Thats it.

删除后,会出现一个对话框,提示您将其添加到哪些目标。选择所有合适的。就是这样。