如何更改 Xcode 的整个版权声明模板?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10097192/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:56:26  来源:igfitidea点击:

How to change entire copyright notice template for Xcode?

xcodecocoaxcode4xcode-templatecopyright-display

提问by Chris

I've found a few answers on how to change your company name, but is there any way to change the entire copyright template in Xcode?

我找到了一些关于如何更改公司名称的答案,但是有什么方法可以更改 Xcode 中的整个版权模板?

For example:

例如:

Change :

改变 :

(c) 2012 MyCoolCompany

to :

到 :

(c) 2012 MyCoolCompany, unauthorized reproduction is prohibited, contact [email protected] for details, etc.

回答by Dr.Kameleon

Go to :

去 :

/Developer/Library/Xcode/Templates/File Templates

or if you're using the newer self contained Xcode.app,

或者如果您使用的是较新的自包含Xcode.app

/Applications/Xcode.app/Contents/Developer/Library/Xcode/Tem??plates/File Templates

To avoid the templates from being clobbered by Xcode updates, make a copy of the template that you want to edit and move it to your home library folder–

为避免模板被 Xcode 更新破坏,请复制您要编辑的模板并将其移动到您的主库文件夹 -

~/Library/Application Support/Developer/Shared/Xcode/File Templates

If - let's say - it's the Objective-C class template you want to change then, go to the following subdirectory :

如果 - 假设 - 这是您想要更改的 Objective-C 类模板,请转到以下子目录:

/Cocoa/Objective-C class.xctemplate

Open :

打开 :

NSObject/___FILEBASENAME___.h
NSObject/___FILEBASENAME___.m

And edit them.

并编辑它们。



Hint :You'll have to tweak as many template files as you need (e.g. if you need your copyright header to be valid for NSDocument subclasses, then make sure you edit those files too... ;-))

提示:您必须根据需要调整尽可能多的模板文件(例如,如果您需要版权标头对 NSDocument 子类有效,那么请确保您也编辑这些文件...;-))



An example (of what my ___FILEBASENAME___files look like) :

一个例子(我的___FILEBASENAME___文件是什么样的):

/******************************************************
 | ___PROJECTNAME___
 |******************************************************
 | File : ___FILENAME___
 | 
 | Created on ___DATE___
 | By Ioannis Zafeiropoulos (a.k.a. Dr.Kameleon)
 |*********************************************************************
 | Copyright (c) ___YEAR___ InSili.co.uk. All rights reserved.
 |*********************************************************************/