Full Rename method for iOS project tutorial
2015-01-04 10:00:50 Source: Cocoachina Keep abreast 0 mobile phone Watch News
Foreword: In iOS development, sometimes want to change the name of the project, will encounter a lot of trouble. Change the project name directly, and Xcode won't help you change all your names. There are always many files, folders, or items that are set by the project. And they are not easy to change, and sometimes change to change, can not compile. So when you rename the project, remember to back up a copy of it first. This article I will introduce a method, I have consulted a lot of information to draw a summary.
Why is that complete? Because after renaming, you will not see any more about the previous project name.
This article will change a project called "test233333333" to "test".
1) Open the project:
The above is the current project structure.
2) Select the project settings and press ENTER to enter the new project name:
3) After entering, press ENTER, pop-up before renaming and renaming the file name, then click "Rename":
4) Then a dialog box will pop up and click "Enable" directly:
5) At this point you will find that there are many "old" project names in the File/folder:
It doesn't matter, keep looking down and get rid of these "old" names together.
6) Let's change the names of the two folders first:
Before change:
After the change:
The testtests here, originally for test233333333tests, we need to change the name of the attention, just need to replace the old name (test233333333) replaced by the new name (test), do not remove the other characters (Tests)!
7) Select this class file, change the class name cannot be renamed directly, need to use Xcode built-in Change class name feature:
Click the class name after @interface:
Follow the steps (Edit->refactor->rename):
Enter a new class name:
Click Save:
8) Once again we look at our directory structure, which has all been changed, but now the compilation will not pass:
9) We tried to build, Xcode reported such an error, unable to find the connection file:
This is because there are a lot of items to change the name of the project, now Xcode is still pointing to the previous project name.
10) Search for the previous item name and replace it with the new item name:
Note: Just replace the comment here, the real project setup requires us to do it manually.
11) Global Search for the old item name comes out of the interface, we click in to change the name:
Click to automatically jump to this interface, double-click the value of the change (the following steps to rename the same):
After the changes, you have to change something. Don't ask why it's so troublesome, just because of caprice.
Note: Continue the global search substitution until the old name is not found in the global search!
12) Open the project folder and continue renaming:
After renaming:
Back to the project to see, the file is full of "red". It doesn't matter, it's normal:
13) Change the resource folder path of the relative folder:
13.1) Check the Test folder:
13.2. Click the Small folder icon to change the path:
Find the file that you just changed your name, and click Choose. The next folder (testtests) step repeats above.
After you've changed it, build again, and you're through.
Results after the project is fully renamed:
Project structure:
Project REAL directory structure:
Http://help.3g.163.com/15/0104/11/AF45ILND00964KAD.html
Full Rename method for iOS project tutorial