Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#pragma mark not showing in methods in Xcode 4.0

Tags:

xcode4

pragma

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 between methods.

I was using these #pragma marks to make it easy to quickly organize and get to information that appears in different sections of my tableviews and I would really like to get that functionality back.

Anyone know how to get them to appear again?

like image 852
Aikitect Avatar asked Mar 15 '11 14:03

Aikitect


3 Answers

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.

like image 108
RantriX Avatar answered Dec 20 '22 23:12

RantriX


I had this problem while using a syntax that used to work on xcode 3.x and does not work for xcode 4 anymore.

I was using just "pragma"

#pragma - My Pragma Text

That used to work fine for xcode 3 but, for xcode 4, the complete syntax has to be used. This means that #pragma must always be followed by the "mark" keyword.

#pragma mark - My Pragma Text

EDIT

Xcode 6 (fixed in beta 4) uses // MARK: syntax for swift files

like image 38
Felipe Sabino Avatar answered Dec 21 '22 00:12

Felipe Sabino


Did #pragma marks work inside of methods in the previous xcode? I really would like to use them, but like you said, it only works in between methods but not within a method, which would be really useful.

BUMP if anybody has any ideas on ways to achieve adding code to a section within a method that would add it to the XCode jump bar...

like image 37
RanLearns Avatar answered Dec 21 '22 00:12

RanLearns