如何创建新的“模板” Xcode 4 上的类别并在那里使用我自己的文件模板?
我想开始为 iOS 应用程序使用我自己的模板。我不想要任何重大更改,但更简单的事情,例如
- 添加/删除一些样板代码
- 添加一些
pragma mark
部分 - 硬编码我公司的名称和每个文件的一些注释
- 更改缩进
- 等等等等
这个想法是我们将在创建应用程序时共享这些模板,但同时我们希望保留 Xcode 4 已经提供的默认模板文件。那么,在下面的屏幕截图中,如何添加包含完全相同的模板(基于导航、基于视图等)但包含我自己的更改的“CompanyName Application”部分?
我发现可以在 /Developer/Library/Xcode/Templates/ 下添加一个文件夹 或
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/
但我对我到底需要做什么感到有点困惑。如果您能帮助我,我将非常感激,因为我已经两次弄乱了我的文件夹,但没有运气。谢谢!
I would like to start using my own templates for iOS applications. I don't want any significant changes, but simpler things like
- 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
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 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此博客文章 borealkiss有详细的说明。对于初学者:
This blog post by borealkiss has detailed instructions. For starters:
我刚刚找到 Bob McCune 的这篇文章“创建Custom Xcode 4 File Templates”这正是我所需要的,所以我把它放在这里供参考。
I just found this article from Bob McCune "Creating Custom Xcode 4 File Templates" that is exactly what I needed, so I put it here for reference.