Skip to content

Instantly share code, notes, and snippets.

@nowsprinting
Created November 12, 2011 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nowsprinting/1359905 to your computer and use it in GitHub Desktop.
Save nowsprinting/1359905 to your computer and use it in GitHub Desktop.
ビルドを実行した年をcopyright表記に埋め込む for Objective-C/iOS project
//ビルド年を求める
char* date = __DATE__;
char* year = date + strlen(date) -4;
NSInteger buildYear = atoi(year);
//Copyrightの設定
if(COPYRIGHT_FIRSTVERSION_YEAR==buildYear){
copyright_.text = [NSString stringWithFormat:@"%@ %d %@",
COPYRIGHT_PREFIX, COPYRIGHT_FIRSTVERSION_YEAR, COPYRIGHT_SUFFIX];
}else{
copyright_.text = [NSString stringWithFormat:@"%@ %d-%d %@",
COPYRIGHT_PREFIX, COPYRIGHT_FIRSTVERSION_YEAR, buildYear, COPYRIGHT_SUFFIX];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment