CreateXcodeEngineeringTemplateAnd codeTemplateThe tutorial is the content to be introduced in this article.XcodeThere is no direct tool for you to createTemplateBut there is a way to easily create what you needTemplate, You only need to modify according to the style, the following two parts: one is to create a projectTemplateAnd create source code.Template
1. Create a project template
You can create a project template to quickly create a project style that you need, saving the process of setting parameters for your project and adding a class library. After you create multiple templates, it will save you a lot of time in your future work, which is very convenient.
XcodeThere is no direct tool or wizard to create a project template for you, but we can find several templates built in Xcode. Here we will introduce the template creation process in iPhone development.
1. First, go to this directory:
- /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application
Below we can see several built-in Xcode templates, such as Navigation-Based Application and OpenGL ES Application.
2. copy any template. To create the template you need, copy the Window-Based Application template and change the name to MyTemplates Application.
3. Enter MyTemplates Application, click the project to open the xcode project interface of MyTemplates Application, and click zoom in)
4. in this project, you can create a project similar to creating a project, modify a bit of code or add a new scoure code, create a group, import the framework, set tartget, and modify info. content in plist, adding icons, etc.
6. You can refer to other Templates projects to learn how to modify the content. It's very simple. I don't need to talk about it anymore!
7. note that when you Add to project or create a new source code, select "Realtive to Enclosing Group" as the path ", in this way, the generated template will be automatically referenced under the folder of your new project, rather than the absolute path.:
8. Click the xcode icon and select "New Project". A panel is displayed. Select iPhone OS/Application. Is the template you want displayed on the right?
Ii. Create a source code file template
When you open an existing xcode project, click 'new file "and select the source code template you need. Is there any custom source code here, if you want to design your own template, we can tell you the following:
In general, it is similar to creating a project template.
1. Similar to creating a project template, go to/Developer/Platforms/iPhoneOS. platform/Developer/Library/Xcode/File Templates
Create the source code template you need here. For iPhone, go to Cocoa Touch Classes and create a new template under this folder.
2. Enter Cocoa Touch Classes and you can see many templates, such as NSObject subclass. pbfiletemplate and UITableViewController subclass. pbfiletemplate.
3. Copy one of them and rename it as the source code Template Name, for example, MyObject subclass. pbfiletemplate.
4. Open MyObject subclass. pbfiletemplate. and modify the content of the class. h. class. m file to the desired content,
5. You can refer to other methods and syntax rules for content modification.Template
6. After modification, you can select "new file" and test whether MyObject is in the template box on the right?
Conclusion: CreateXcodeEngineeringTemplateAnd codeTemplateI hope this article will help you with the introduction of this tutorial! MoreXcodeFor more information, see edit recommendations.