Where is this useful feature located in XCode?

Discussion in 'Mac Programming' started by chrono1081, Jul 2, 2010.

  1. chrono1081 macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #1
    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.
     

    Attached Files:

  2. Ap0ks macrumors 6502

    Joined:
    Aug 12, 2008
    Location:
    Cambridge, UK
    #2
    I'm not at my Mac right now, but if you've got the pragma directive in place, you should be able to click on the method navigator to get that menu pop-up.

    The method navigator is the section labelled -showHideInfoPanel: in the following screenshot.
    http://www.macresearch.org/files/Xcode_IB_Intro/002.jpg
     
  3. chrono1081 thread starter macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #3
    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 :)
     
  4. ianray macrumors 6502

    Joined:
    Jun 22, 2010
    Location:
    @
    #4
    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 :)
     
  5. chrono1081 thread starter macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #5
    Thank you :)

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

    Joined:
    May 10, 2009
    Location:
    Des Moines, WA
    #6
    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.
     
  7. chrono1081 thread starter macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar

Share This Page