简体   繁体   English

ios - 将外部文件添加到我的新项目的正确方法是什么?

[英]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.

相关问题 ios - 将图像添加到捆绑包中的正确方法是什么? - ios - what is the correct way to add images to the bundle? 将框架添加到要包含在Subversion中的iOS项目中的正确方法 - Correct way to add frameworks to an iOS project to be included in subversion 当我的应用程序在iOS上终止时,保存NSUserDefaults的正确方法是什么 - What is the correct way to save NSUserDefaults when my app is terminated on iOS 在iOS 8中,什么是在视图控制器中除按钮之外的所有内容上添加手势识别器而不添加其他按钮的正确方法? - In iOS 8 what is the correct way to add a gesture recognizer on everything in my view controller except a button, without adding an additional button? 如何纠正xcode iOS项目中丢失的文件 - How to correct missing files in xcode iOS project 在ios项目中使用静态库在xcode 4中创建存档的正确方法是什么? - What is the correct way to set build configurations in an ios project using static libraries for creating an archive in xcode 4? 从 iOS 11+ 项目中删除 SceneDelegate 的正确方法 - 应用程序中需要什么代码(_:didFinishLaunchingWithOptions) - Correct way of removing SceneDelegate from iOS 11+ project - What code is necessary in application(_: didFinishLaunchingWithOptions) 通过 Swift 在 iPhone(iOS)开发中存储/检索用户数据(读/写文件)的正确方法是什么? - What is correct way to store/retrieve user data (read/write files) in iPhone (iOS) dev via Swift? 从iOS访问O365上文件的正确和正确方法是什么 - What's the proper and correct way to access files on O365 from iOS 为IOS设置模型的正确方法是什么? - What is the correct way to setup a Model for IOS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM