3

I'm a newb to cocoa programming and looking around in various open source code online I see things like:

#pragma mark global variable declaration

and I was wondering what the meaning of "pragma mark" is in that is it any different than a // or /* (comment) block..like is it used throughout the program, and is there a commonly used methodology to it, or is it more or less a way for programmers to organize and collect their code for themselves (and others if the case may be) to use later?

I found this article: http://inchoo.net/mobile-development/iphone-development/what-is-a-pragma-mark/

and it is pretty helpful, but I just needed to clarify again if it's more or less used by the coder or used by XCode?

Thanks!

Zac Brown
  • 33
  • 1
  • 3

1 Answers1

6

pragma mark is used by xcode to organize your code by creating as drop down list of methods contained within the scope of the pragma mark.

ennuikiller
  • 1,168
  • excellent clarification! that's a very helpful feature. are there any "standard" methods of using it or is it just up to the developer? – Zac Brown May 15 '11 at 23:26
  • @Zac Not a lot of standard methods, but in Xcode 4 if you use #pragma mark - My Cool Section, the hyphen right there will make Xcode display a horizontal line in the menu, under which will be (in this example) My Cool Section. – Matthew Frederick May 15 '11 at 23:50
  • wow, that's pretty cool. I'll play around with it and I bet it's really helpful. after I've achieved more rep I'll come back and vote this answer up :-) – Zac Brown May 15 '11 at 23:56