Objective-C 中常量的命名约定是什么(或最广泛使用的命名方式)?
extern
常量有不同的标准吗?
我见过的一些款式:
NSString* const kPreferenceFirstRun = @"FirstRun";
// Replace "XY" by a prefix representing your company, project or module
NSString* const XYPreferenceFirstRun = @"FirstRun";
最佳答案
经过一番谷歌搜索后,我找到了 official coding guidelines for Cocoa .
总结一下:
extern
常量的相同标准我同意 itaiferber 的观点,即 k 前缀样式更清晰,对自动完成也更有用。想知道这种风格是否比官方指南更受欢迎。
https://stackoverflow.com/questions/4058235/
相关文章:
ios - 在从 UIViewController 调用的非保留完成中引用 self 时,weakS
objective-c - 调用 -retainCount 被认为是有害的
ios - scaledValueForValue : called on a font that
iphone - 关于带有文本字段的 UIAlertView...
ios - Objective-C,如何获取 UTC 时区的当前日期?
iphone - MKMapView 缩放到 viewDidLoad 上的用户位置?
objective-c - CAEmitterLayer 在触摸事件中随机发射不需要的粒子