Normally I would put private methods in the header file. But noticed from "Learn Cocos2D 2nd Edition" book a different way been used.
The header file is quite simple:
The private methods are however declared in the .m file as shown below with "(PrivateMethods)" added behind "@interface":
This is completely new to me and indeed quite interesting!
The header file is quite simple:
#import "cocos2d.h"
@interface HelloWorld : CCLayer
{
}
// returns a Scene that contains the HelloWorld as the only child
+(id) scene;
@end
The private methods are however declared in the .m file as shown below with "(PrivateMethods)" added behind "@interface":
#import "HelloWorldScene.h"
// private methods are declared in this manner to avoid "may not respond to ..." compiler warnings
@interface HelloWorld (PrivateMethods)
-(void) onCallFunc;
-(void) onCallFuncN:(id)sender;
-(void) onCallFuncND:(id)sender data:(void*)data;
-(void) onCallFuncO:(id)object;
-(void) createLabelWithOffset:(int)offset;
@end
@implementation HelloWorld
This is completely new to me and indeed quite interesting!