如何在不破坏文件的情况下重命名xcode项目中的文件夹名称 [英] How to rename the folder name in xcode project with out corrupting the files

查看:738
本文介绍了如何在不破坏文件的情况下重命名xcode项目中的文件夹名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的xcode项目中,我创建了一个名为MyClasses的文件夹,用于将新添加的文件/类放到此文件夹中。

In my xcode project i have created a folder manually named "MyClasses" to place the newly added files/classes to this folder.

现在我在这个文件夹中有近30个课程。

Now i have nearly 30 classes in this folder.

当我重命名这个文件夹时,这个文件夹中的所有文件都被删除了。

when i renamed this folder , all the files in this folder are gets Erased.

现在我需要将文件夹重命名为 ViewControllerClasses

Now i need to rename the folder to "ViewControllerClasses".

但是我丢失了30 .h,.m,xib文件。 [幸运的是我有一份副本&和zip文件]

But i lost 30 .h, .m, xib files. [lucky i have a copy & and zip file]

如何在不破坏文件的情况下重命名文件夹。

How to rename the folder with out corrupting the files.

重命名它到myviewcontrollerclasswes

Renamed it to myviewcontrollerclasswes

当我重命名时


推荐答案

注意截至2017年:
现在Xcode 9同步文件夹和项目自动层次结构。

NOTE as of 2017: Now Xcode 9 synchronises the folder and the project hierarchy automatically.

注意截至2013年:
复制并重命名Xcode项目&相关文件夹

您在项目文件下的XCode中看到的文件夹不是真正的文件夹文件系统,只有.xcodeproj文件中管理的虚拟文件夹。您可以独立于文件系统中的位置组织项目文件夹中的文件。有些人更喜欢在项目文件夹结构中映射文件系统文件夹结构,有些人更喜欢将所有源文件存储在文件系统中的一个大文件夹中,并且只在项目文件夹中组织它们:这是一个偏好问题。

The "folders" what you see in XCode under your project file are not real folders in the file system, only virtual folders administered in the .xcodeproj file. You can organize your files in the project folder independently from their location in the file system. Some prefers to map the file system folder structure inside the project folder structure, some others store all source files in one big folder in the file system and organize them only in the project folders: it's rather a question of preference.

但是,如果您重命名/移动物理文件系统中的文件,则必须删除并重新添加它们到您的项目,因为XCode将不知道在哪里找到他们。注意不要删除它们物理只从XCode项目中删除它们,然后重新添加它们并根据需要重新组织。

However if you rename/move physically the files in the file system, you will have to delete and re-add them to your project since XCode will not know where to find them. Pay attention not to delete them physically only remove them from XCode project, then re-add them and reorganize as you want.

还有一件事注意:如果您使用版本控制系统,您还必须通知其客户端(最有可能是svn或git)您已重命名/移动了文件。如果要保留文件修订历史记录,最好将版本/移动命令显式发布到版本控制,否则它会将您的文件视为从旧位置删除并在新位置添加为新文件。

One more thing to note: if you are using version control system you will have to inform also its client (svn or git most likely) that you have renamed/moved your files. If you want to keep file revision history it will be a good idea to issue the copy/move command explicitly to the version control otherwise it will treat your files as deleted from the old location and added as new in the new location.

这篇关于如何在不破坏文件的情况下重命名xcode项目中的文件夹名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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