How to View Comments in the Method Navigator of Xc

2020-07-23 03:38发布

问题:

Does anyone know how to view comments in the method navigator in Xcode 4

In Xcode 3 these would put comments like:

???: Huh?
!!!: Woah
MARK: Aliens
TODO: Fix this

in here...

回答1:

You can still use // ???:, // FIXME: and // TODO: comments outside of methods to get the comment to pop up in the method navigator.

I know that some people would like these type of comments within methods to still show up in the method navigator and that there is a bug report filed against this, but I actually like this bug, as it forces me to keep my methods clean. I find that putting the // TODO:, etc., above the method creates better code readability.

Just my opinion.



回答2:

You can even to that in one line (comment and separator):

so instead of:

#pragma mark - 
#pragma mark MyCoolMethod

Just type as below:

#pragma mark - MyCoolMethod
- (void) myCoolMethod {
    //Code here...
}


回答3:

use the following:

#pragma mark your_comment_here

You can also use the following to add separator lines:

#pragma mark -