未正确添加文件夹到Xcode项目 [英] Adding Folder to Xcode Project is not Properly added

查看:97
本文介绍了未正确添加文件夹到Xcode项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

团队,

我创建了新项目,在项目文件夹上,右键单击打开,在finder中显示,创建了 ViewControllers文件夹,然后再次右键单击添加文件到 ProjectName,然后添加创建的文件夹,即 ViewControllers,它是蓝色的 Expected yellow color folder(蓝色文件夹),它引用了我的项目文件夹,而蓝色文件夹则不是。
在蓝色文件夹中,当我尝试添加新文件时,它添加了一个空文件。

I created the new Project, on project folder right click open show in finder there I created "ViewControllers" Folder and again right click Add files to "ProjectName" then I added the created folder i.e., "ViewControllers" which is in blue colour "Expected yellow colour folder" that is reference to my project folder the blue colour folder is not. In blue colour folder when i try to added new file its added an empty File.

如何将添加的文件夹引用到Xcode项目中?
如何避免在我的项目中出现这种蓝色文件夹类?

How can i reference my added folder to the Xcode project? how to avoid this blue colour folder class in my project?

您的输入非常可观。

推荐答案

如果您的Xcode项目看起来像这样……

If your Xcode project looks like this…

...然后,您已经添加了 ViewControllers 文件夹作为文件夹引用。

…then you've added your ViewControllers folder as folder reference.

要将此文件夹更改为一组,请按照以下步骤操作:


  • 右键单击 ViewControllers

  • 在上下文菜单中选择 Delete

  • 在弹出的对话框中选择删除引用。该文件夹将从您的Xcode项目中删除,但不会从文件系统中删除。

  • 然后选择将文件添加到< YourProjectName>…文件菜单

  • 在文件系统中找到 ViewControllers

  • 在单击添加之前,请确保已选择选项创建组

  • 单击添加

  • Right click on ViewControllers
  • Choose Delete in the context menu
  • Choose Remove Reference in the dialog that popped up. The folder will be removed from your Xcode project but not from the file system.
  • Then choose Add Files to <YourProjectName>… in the File menu
  • Find your ViewControllers in the file system
  • Before clicking Add make sure that the option Create groups is selected
  • Click Add

您已添加您的 ViewControllers 文件夹作为组:

You've added your ViewControllers folder as group:

关于Xcode 8的重要说明:

创建组选项可能不会立即显示。 Apple在Xcode 8中将其移至了将文件添加到…对话框的底部:

The option Create groups might not be visible right away. Apple moved this in Xcode 8 to the bottom of the Add Files to… dialog:

这显示了创建组的选项:

这篇关于未正确添加文件夹到Xcode项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆