#pragma mark not showing in methods in Xcode 4.0

前端 未结 13 1896
死守一世寂寞
死守一世寂寞 2021-01-01 13:16

In Xcode Version 4.0 I notice that #pragma marks within methods are no longer showing up in the Jump Bar. The only #pragma marks that are showing up are those that are betwe

13条回答
  •  耶瑟儿~
    2021-01-01 13:25

    I'm also experiencing this problem. A pragma mark added before the first method will not show up. For example, this will not work:

    @implementation RandomClass
    
    #pragma mark - Getter Methods
    
    - (void) firstMethod
    {
    }
    
    @end
    

    Here are some quick-dirty workarounds to make the pragma mark before the first method show up. You can add an empty block before it or you can just put the pragma mark inside the block itself.

    Using an empty block:

    @implementation RandomClass
    {}
    #pragma mark - Getter Methods
    
    - (void) firstMethod
    {
    }
    
    @end
    

    Adding the pragma mark inside the empty block itself:

    @implementation RandomClass
    {
    #pragma mark - Getter Methods
    }
    
    - (void) firstMethod
    {
    }
    
    @end
    

    It doesn't look too pretty but it works. I hope that helps.

提交回复
热议问题