Starting constants with a "k" is a legacy of the pre-Mac OS X days. In fact, I think the practice might even come from way back in the day, when the Mac OS was written mostly in Pascal, and the predominant development language was Pascal. In C, #define
'd constants are typically written in ALL CAPS, rather than prefixing with a "k".
As for where to #define
constants: #define
them where you're going to use them. If you expect people who #import
your code to use the constants, put them in the header file; if the constants are only going to be used internally, put them in the .m
file.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…