创建Xcode 模板

 

To make your own Xcode Project Template for iPhone development follow these steps:

  1. Open a new finder window and navigate to ~/Library/Application Support/Developer/Shared/Xcode/ (note the ~)
  2. Create a new directory in here called Project Templates/
  3. Go into the newly created Project Templates/ directory and create a directory for the group your templates will appear in within the new project dialog in Xcode. In this example we will use MyApplication.
  4. Open a new finder window and navigate to /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application
  5. Copy one of the project templates (the one that best meets your needs) from here to the MyApplication directory we just created.
  6. Rename the copied project template directory to the name you want your template to be called.
  7. Go into this directory and you'll find an Xcode project called ___PROJECTNAME___.xcodeproj - Open this project like any normal project and edit it to how you want your newly created projects made from this template to be. You can use ___PROJECTNAME___ in files and directory names and in code and it will be replaced with the project name.___PROJECTNAMEASIDENTIFIER___ can be used for code where you don't want spaces or other characters.
  8. After setting up your project template how you like, make sure it builds and then go and delete the build directory from the template directory because you don't want it to create that in new projects. Inside the ___PROJECTNAME___.xcodeproj directory you should also delete the username.* files (where username is your username), these contain things like window state and open files information from the last time you edited the project. If you ever edit your template later on, you'll need to delete these files again.
  9. Finally, change the description of your template in the ___PROJECTNAME___.xcodeproj/TemplateInfo.plist file and optionally change the icons file___PROJECTNAME___.xcodeproj/TemplateIcon.icns. Search the web for how to edit .icns files, that's not covered here.

You can even add your project template to SVN and Xcode won't copy the .svn directories when it creates a new project. This can make it easy to merge useful changes from projects back into your template.

     

    • 0
      点赞
    • 0
      收藏
      觉得还不错? 一键收藏
    • 0
      评论

    “相关推荐”对你有帮助么?

    • 非常没帮助
    • 没帮助
    • 一般
    • 有帮助
    • 非常有帮助
    提交
    评论
    添加红包

    请填写红包祝福语或标题

    红包个数最小为10个

    红包金额最低5元

    当前余额3.43前往充值 >
    需支付:10.00
    成就一亿技术人!
    领取后你会自动成为博主和红包主的粉丝 规则
    hope_wisdom
    发出的红包
    实付
    使用余额支付
    点击重新获取
    扫码支付
    钱包余额 0

    抵扣说明:

    1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
    2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

    余额充值