Full Rename method for iOS project tutorial

Source: Internet
Author: User

Original link: Http://www.cocoachina.com/ios/20150104/10824.htmliOS Project's complete renaming method graphic tutorial

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:

Summary: Do not change the project's friends, remember to back up before the first good OH.

Add:

Text-Find and text-replace features in Xcode
1. If it is within the scope of the open document:Search: command+ FReplacement: Option+command+fReplace all replaces all strings within the scope of this documentReplace replaces the current stringReplace & Find is an edge lookup edge replacement2. If the global find and replacefind: Click on the "Magnifier" button in the left-hand toolbar or Shift+command +fReplace: click the "Magnifier" button in the left-hand toolbar, then change the left Find to replace. or shift+option+command+f .

Full Rename method for iOS project tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.