Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chrono1081

macrumors G3
Original poster
Jan 26, 2008
8,456
4,164
Isla Nublar
So I was referencing an old iPhone programming book I had the other day and noticed on one of the pages there is a neat little pragma directive that lets you put methods into a little pop up window all nice and organized which would be great.

However I have no clue how to get this little window to appear (or even what its called, so I cant search for it). Its not anywhere in the book either (see picture).

Anyone know what this little pop up window is called? Or how I can get it to appear? Its the window that has "Picker Data Source Methods" highlighted.
 

Attachments

  • Screen shot 2010-07-02 at 10.39.12 AM.png
    Screen shot 2010-07-02 at 10.39.12 AM.png
    343.1 KB · Views: 105

chrono1081

macrumors G3
Original poster
Jan 26, 2008
8,456
4,164
Isla Nublar
Thank you so much! That worked :) I had no clue where they were clicking or what that little panel was called. I missed hitting it somehow with my mindless clicking (I swear I clicked everywhere! lol).

This is a very nice feature :)
 

ianray

macrumors 6502
Jun 22, 2010
452
0
@
...there is a neat little pragma directive that lets you put methods into a little pop up window all nice and organized which would be great.

Further to the previous answer, methods (amongst other things) are shown automatically in the picker window, but #pragma directives allow you to add your own entries.

Code:
#pragma mark -
#pragma mark Delegate methods

The "mark -" directive places a separator line in the picker window :)
 

chrono1081

macrumors G3
Original poster
Jan 26, 2008
8,456
4,164
Isla Nublar
Thank you :)

I've been going through my project like mad adding all of these. It will make debugging much nicer :)
 

lloyddean

macrumors 65816
May 10, 2009
1,047
19
Des Moines, WA
If you're writing cross-platform code some compilers will complain when they trip over unfamiliar 'pragma' statements.
For this reason I use 'pragma' statements only when necessary and usually surrounded with conditionals. In this case
'pragma mark' is not necessary. Instead use the comment version which doesn't emit unknown 'pragma' noise on other
platforms.

The comment version uses whatever constitutes a comment in the language currently in used. For 'C++' and 'C89' it would
be '/* */' or '//'

Anyway the following provides the same usefulness whitout using 'pragma'.

// MARK: -
// MARK: SUBROUTINES
// FIXME: See bug report <URL/BUG143>
// TODO: We may want to add feature <URL/TODO182>
// !!!: Warning beware the following consequences!
// ???: WTH Is this supposed to do?

EDIT: Oh, and that menu can be accessed form the keyboard by pressing Control-2. The arrow keys to move up and down and the Return to select the currently hilited item.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.