I am trying to call a method from a layer. The method in question is in the parent of that layer.
Example:
"Survival" is the name of my scene "SSpriteLayer" is the name of my layer
SSpriteLayer.m
//this id not my actual method, just a simplified version
-(void) spritePick {
[scene initSpritePick];
NSLog(@"sent");
{
SSpriteLayer.h
#import Survival
@interface SSpriteLayer : CCLayer {
Survival *scene;
}
Survival.m
- (void) initSpritePick {
NSLog(@"test");
}
The text "test" never appears in the log, but the method in my layer is called. The problem is that even though the call for the method is sent, it never finds the method, and nothing happens. I do not get any error messages.
I have tried every way to do this that I know, so please can you give me some suggestions, or point out the problem.
Try using Class Method it will work
Example:
"Survival" is the name of my scene "SSpriteLayer" is the name of my layer
**SSpriteLayer.m**
//this id not my actual method, just a simplified version
-(void) spritePick
{
[Survival initSpritePick];
NSLog(@"sent");
{
}
**SSpriteLayer.h**
#import Survival
@interface SSpriteLayer : CCLayer {
Survival *scene;
}
**Survival.m**
+ (void) initSpritePick
{
NSLog(@"test");
}
Regards, Neil.