Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

#pragma mark not listing the first group name

I'm using #pragma mark for grouping my methods under certain categories. But the issue is in Xcode 4 my first category is not displaying.

My code looks like:

@interface MyClass : NSObject

#pragma mark -
#pragma mark Category 1

//Some method declaration

#pragma mark -
#pragma mark Category 2

//Some method declaration

#pragma mark -
#pragma mark Category 3

//Some method declaration
@end

But when I check on Xcode It displays only Category 2 and Category 3. Category 1 is not listed there, please check the Image Pragma Issue

Is there any issue in my code or is it a bug in XCode ?

like image 552
Midhun MP Avatar asked Mar 15 '13 10:03

Midhun MP


2 Answers

Yes it is a Bug here.

But you can override this bug to your requirement by just adding {} in your interface .h file/ as well as in implementation / .m file :

@implementation AppDelegate
{}

#pragma mark -
#pragma mark Category 1

-(void)awakeFromNib{

}

Also, no need to use two #pragma, you can combine both of them into one as :

#pragma mark - Category 1

enter image description here

like image 196
Anoop Vaidya Avatar answered Nov 03 '22 21:11

Anoop Vaidya


Another clean way to go : just add a simple ;.

@implementation AppDelegate;

#pragma mark - Category 1
like image 13
Philoozushi Avatar answered Nov 03 '22 19:11

Philoozushi