Xcode 更改/删除注释模板
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9406311/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode change/remove comment template
提问by Martin Tuskevicius
Recently I've been learning how to program C. For most of the time, I have been using the C version of Eclipse. Recently, I tried out Xcode. I am using a Mac running Mac OS X Lion - Xcode version 4.1.
最近我一直在学习如何编程 C。大部分时间,我一直在使用 Eclipse 的 C 版本。最近,我尝试了 Xcode。我使用的是运行 Mac OS X Lion - Xcode 4.1 版的 Mac。
There is one grievance I have: at the top of every file that I create, there is this little section of comments that I wish to remove or better yet, change.
我有一个不满:在我创建的每个文件的顶部,都有一小部分我希望删除或更好的评论。
When I create a file, something like this is put at the top of the file by default:
当我创建一个文件时,这样的东西默认放在文件的顶部:
//
// FILE.c
// PROJECT NAME
//
// Created by Martin Tuskevicius on DATE.
// Copyright YEAR ORGANIZATION (my school name for some reason). All rights reserved.
//
Obviously the things in capitals would be replaced with an actual value. For those of you have use, or have used Xcode, for programming C - do you know a way of how to change or remove these default comments?
很明显,大写的东西会被一个实际的价值代替。对于那些已经使用或已经使用 Xcode 进行 C 编程的人 - 您知道如何更改或删除这些默认注释的方法吗?
I really appreciate any help. Thanks!
我真的很感激任何帮助。谢谢!
采纳答案by fannheyward
UPDATE:
更新:
According to @Michael Dautermann 's comment below, change templates in Xcode.app bundle is not a good way. Check https://stackoverflow.com/a/33743/380774for more information.
根据@Michael Dautermann 在下面的评论,在 Xcode.app 包中更改模板不是一个好方法。查看https://stackoverflow.com/a/33743/380774了解更多信息。
You can remove or change the header in File Templates, I'm using Xcode 4.3, and the File Templates is in /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates
.
您可以删除或更改文件模板中的标题,我使用的是 Xcode 4.3,文件模板在/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File Templates
.
回答by Linh Nguyen
You can change it in Xcode project File.
This is my image for tutorial :D
Very easy!!!
您可以在 Xcode 项目文件中更改它。这是我的教程图像 :D 非常简单!!!
回答by uliwitness
Please do not edit files inside Xcode, that will break the application signatureand will cause Xcode to refuse to start up after the next restart or so.
请不要在Xcode内部编辑文件,这会破坏应用程序签名并导致Xcode在下次重启后拒绝启动。
Create an IDETemplateMacros.plist
file containing a dictionary with a FILEHEADER
key (string) instead.
创建一个IDETemplateMacros.plist
包含带有FILEHEADER
键(字符串)的字典的文件。
You can put the file in
你可以把文件放在
- for all users on a single project by dropping it in your project's or workspace's
xcshareddata
folder (e.g.MyAppWorkspace.xcworkspace/xcshareddata/IDETemplateMacros.plist
) - for yourself for a single project by copying it into e.g
MyAppWorkspace.xcworkspace/xcuserdata/YOURNAMEHERE.xcuserdatad
- global for all projects that you open in your account by dropping the file in
~/Library/Developer/Xcode/UserData/
- 通过将其放在项目或工作区的
xcshareddata
文件夹中,为单个项目的所有用户(例如MyAppWorkspace.xcworkspace/xcshareddata/IDETemplateMacros.plist
) - 通过将其复制到例如,为您自己的单个项目
MyAppWorkspace.xcworkspace/xcuserdata/YOURNAMEHERE.xcuserdatad
- 通过将文件拖放到您在帐户中打开的所有项目的全局
~/Library/Developer/Xcode/UserData/