[英]ios - What is the correct way to add outside files to my new project?
I have about 20 image files which I would like to a new project.我有大约 20 个图像文件,我想要一个新项目。 I tried to make my code base clean so I made a group src/img where I intended to place the images.
我试图让我的代码库干净,所以我创建了一个 src/img 组,我打算在其中放置图像。
Then I tried to copy the images via the file system, and obviously the groups that I made did not also create folders.然后我尝试通过文件系统复制图像,显然我创建的组也没有创建文件夹。 So before I do anything that would dirty-up the code base, I wanted to ask here.
所以在我做任何会弄脏代码库的事情之前,我想在这里问一下。
What is the correct way to add the files I want to add so they would render in my group under proj_name/src/img ?添加我想要添加的文件以便它们在我的组中呈现在 proj_name/src/img 下的正确方法是什么?
Thanks!谢谢!
You can first create a folder src/img inside your project in filesystem and copy all of your images in that folder.您可以首先在文件系统中的项目中创建一个文件夹 src/img 并复制该文件夹中的所有图像。 Then drag the whole img folder to your project in Xcode, but make sure you don't check copy files option when you drag.
然后将整个 img 文件夹拖到 Xcode 中的项目中,但请确保在拖动时不要选中复制文件选项。 But, do select the option to create group so that image folder dragged is also a group in Xcode
但是,请选择创建组的选项,以便拖动的图像文件夹也是 Xcode 中的一个组
The filesystem location is not represented by Xcode project groups.文件系统位置不由 Xcode 项目组表示。
The groups you are creating are supposed to be organized by you, but Xcode also provides useful options like automatically creating groups for the folders checkbox when you are adding new files to the project.您创建的组应该由您组织,但 Xcode 还提供了有用的选项,例如在您向项目添加新文件时自动为文件夹创建组复选框。
After the files are added to the project, you are free to "move" them to other groups or rename groups, that changes will be stored at the project bundle.将文件添加到项目后,您可以自由地将它们“移动”到其他组或重命名组,这些更改将存储在项目包中。 Of course if you make the filesystem changes you'll have to remove the broken references from the project and recreate them.
当然,如果您对文件系统进行更改,则必须从项目中删除损坏的引用并重新创建它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.