Objective C - Why do constants start with k

后端 未结 6 914
栀梦
栀梦 2020-12-05 04:10

Why do constants in all examples I\'ve seen always start with k? And should I #define constants in header or .m file?

I\'m new to Objective C, and I don\'t know C. I

6条回答
  •  感情败类
    2020-12-05 04:34

    The question of what the "k" means is answered in this question.

    And if you intend for files other than that particular .m to use these constants, you have to put the constants in the header, since they can't import the .m file.

    You might be interested in Cocoa Dev Central's C tutorial for Cocoa programmers. It explains a lot of the core concepts.

提交回复
热议问题