问题描述
我想开始使用自己的iOS应用程序模板。我不希望任何重大更改,但更简单的事情,如
I would like to start using my own templates for iOS applications. I don't want any significant changes, but simpler things like
- 添加/删除一些样板代码
- 添加一些
pragma mark
部分 - 硬编码我公司的名称和每个文件的一些注释
- 更改缩进
- 等等
- add/remove some boilerplate code
- add some
pragma mark
sections - hardcode my company's name and some comments for every file
- change the indentation
- etc etc etc
我们的想法是,我们将分享这些我们创建应用时的模板,但同时我们希望保留 Xcode 4已经提供的默认模板文件。因此,在下面的屏幕截图中,如何添加CompanyName应用程序部分,其中包含完全相同的模板(基于导航,基于视图等),但我自己的更改?
The idea is that we will share these templates when we create apps, but at the same time we want to keep the default template files that Xcode 4 already provides. So, in the following screenshot, how can I add a "CompanyName Application" section that contains exactly the same templates (Navigation-based, View-based etc), but with my own changes?
I发现我可以在 / Developer / Library / Xcode / Templates /
或 /Developer/Platforms/iPhoneOS.platform/Developer/Library/下添加一个文件夹Xcode /
但我对我需要做什么感到困惑。我真的很感激,如果你可以帮助我,因为我已经搞砸了我的文件夹两次没有运气。谢谢!
I found that I can add a folder under /Developer/Library/Xcode/Templates/
or /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/
but I'm a bit confused with what do I need to do exactly. I would really appreciate it if you could help me with that, as I have already messed up my folders twice with no luck. Thanks!
推荐答案
的博文详细说明。对于初学者:
This blog post by borealkiss has detailed instructions. For starters:
~/Library/Developer/Xcode/Templates/
问题是创建自定义模板非常困难。
例如,要将
内置模板复制并粘贴到您的位置,
不会在Xcode 4
上显示模板,直到您手动更改其
标识符为止在TemplateInfo.plist中。
The problem is that it is quite hard to create a custom template. For example, to copy and paste the built-in template to your place will not show up the template on Xcode 4 until you manually change its identifier in TemplateInfo.plist.
这篇关于如何创建新的“模板” Xcode 4上的类别并在那里使用我自己的文件模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!