重命名 xcode 4 项目和实际文件夹 [英] Renaming xcode 4 project and the actual folder

查看:35
本文介绍了重命名 xcode 4 项目和实际文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何在 Xcode 4 中重命名项目,但是如何重命名源文件夹?问题是在 Xcode 中重命名项目,只会在 Xcode 内重命名(尽管与以前相比有所进步) - 但我不知道为什么 Xcode 没有重命名文件系统中的文件夹.

I know how to rename the project in Xcode 4, but how do you rename the source folder? The thing is that renaming the project in Xcode, does only rename within Xcode (Though it is progress compared to previous) - but why Xcode is not renaming the folder in the filesystem I don't know.

推荐答案

您可以在 Xcode 中执行此操作,而无需在文本编辑器中手动编辑 pbxproj 文件!

You can do this from within Xcode without resorting to hand editing the pbxproj file in a text editor!

方法如下:

  1. 在 Finder 中重命名源文件夹.这最初会破坏项目,因为 Xcode 不会自动检测虚拟(黄色)项目文件夹指向的真实文件夹何时发生更改,因此该文件夹中的所有文件在 Xcode 中都将变为红色.别担心,我们会在第 3 步中修复它.

  1. Rename your source folder in the Finder. This will break the project initially because Xcode doesn't automatically detect when the real folders that the virtual (yellow) project folders point to are changed, so all the files inside that folder will turn red in Xcode. Don't worry about that, we'll fix it in step 3.

在 Xcode 中,单击左侧边栏中的(现已损坏的)虚拟文件夹并将其重命名以匹配 Finder 中的名称(您实际上可以随意命名它,或者根本不重命名),但那会很疯狂).这不会修复文件夹中的红色文件,但没关系.

In Xcode, click on the (now broken) virtual folder in the left-hand sidebar and rename it to match the name in the Finder (you can actually call it anything you want, or not rename it at all, but that would be insane). That won't fix the red files inside the folder, but that's OK.

在 Xcode 的右侧边栏中,单击下面屏幕截图中显示的图标以打开文件对话框.选择您之前重命名的文件夹.这会将虚拟文件夹与磁盘上的真实文件夹重新关联,并自动修复指向其中所有文件的链接.

In the right-hand sidebar in Xcode, click the icon shown in the screenshot below to bring up a file dialog. Select the folder that you previously renamed. This will re-associate the virtual folder with the real folder on disk, and will automatically fix the links to all the files inside.

在您的构建设置中,搜索旧文件夹名称并手动重命名您找到的任何匹配项.通常有两个,oldfolder/prefix.pch 和 oldfolder/info.plist,但可能还有其他.

In your build settings, search for the old folder name and manually rename any occurrences you find. There will typically be two of them, oldfolder/prefix.pch and oldfolder/info.plist, but there may be others.

大功告成!

此选项在 Xcode 5 中仍然存在,但默认情况下隐藏起来很有帮助.要显示它,请在文本设置"面板上方的检查器中单击细小的身份和类型"标题以将其展开.

this option is still there in Xcode 5, but is helpfully hidden by default. To show it, click the thin "Identity and Type" header in the inspector above the "Text Settings" panel to expand it.

这篇关于重命名 xcode 4 项目和实际文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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