问题描述
在我的 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 文件.[幸运的是我有一份副本&和压缩文件]
But i lost 30 .h, .m, xib files. [lucky i have a copy & and zip file]
如何在不损坏文件的情况下重命名文件夹.
将其重命名为 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 项目中的文件夹名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!