为什么我的 Xcode 项目中有一些蓝色文件夹?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10353274/
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
Why are there some blue folders in my Xcode project?
提问by samir
When I import my project from Github, I have two folders which appear in Xcode with a blue color, but all the other folders are yellow. What's going on?
当我从 Github 导入我的项目时,我有两个文件夹在 Xcode 中显示为蓝色,但所有其他文件夹都是黄色的。这是怎么回事?
采纳答案by rcourtna
Blue is used to represent a "Folder Reference".
蓝色用于表示“文件夹引用”。
A clear description of what these are and when to use them comes from http://struct.ca/2010/xcode-folder-references/
这些是什么以及何时使用它们的清晰描述来自http://struct.ca/2010/xcode-folder-references/
There are two types of folders in Xcode: groups and folder references. You can use groups to organize files in your project without affecting their structure on the actual file system. This is great for code, because you're only going to be working with your code in Xcode. On the other hand, groups aren't very good for resource files.
On any reasonably complicated project, you'll usually be dealing with dozens – if not hundreds – of asset files, and those assets will need to be modified and manipulated from outside of Xcode, either by you or a designer. Putting all of your resource files in one flat folder is a recipe for disaster. This is where folder references come in. They allow you to organize your files into folders on your file system and keep that same folder structure in Xcode.
Xcode 中有两种类型的文件夹:组和文件夹引用。您可以使用组来组织项目中的文件,而不会影响它们在实际文件系统上的结构。这对代码非常有用,因为您将只在 Xcode 中处理您的代码。另一方面,组不太适合资源文件。
在任何相当复杂的项目中,您通常会处理数十个(如果不是数百个)资产文件,并且这些资产需要由您或设计师从 Xcode 外部修改和操作。将所有资源文件放在一个平面文件夹中是一种灾难。这就是文件夹引用的用武之地。它们允许您将文件组织到文件系统上的文件夹中,并在 Xcode 中保持相同的文件夹结构。