Hello all my fellow programmers :] i have an error, help if you can.

Forums Programming Programming – Everything else Hello all my fellow programmers :] i have an error, help if you can.

This topic contains 4 replies, has 3 voices, and was last updated by  willingtolearn 1 year, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
Author Posts
Author Posts
November 8, 2012 at 6:23 am #245206

willingtolearn
Participant
@willingtolearn

So i’m trying to make a button to take me to another scene like a start button. This is the error:

instance meathod ‘target:selector:’ not found (return type defaults to ‘id’)

what does this mean exactly?here is the trouble causing snippet:

if( (self=[super init]) ) {

CCMenuItemImage *item1 = [[CCMenuItemImage itemWithNormalImage:@"icon.png" selectedImage:@"icon.png"] //<


HERE

target:self

selector:@selector(doThis:)];

CCMenu *menu = [CCMenu menuWithItems:item1, nil];

[self addChild:menu];

}

return self;

}

-(void)doThis:(id)sender{

}

i really don’t know what i’m doing wrong here, any advice is much appreciated.

thanks a bunch

November 8, 2012 at 9:08 am #391778

Thomvis
@thomvis

I think you have the closing square bracket on the wrong place. It should be more like this:

CCMenuItemImage *item1 = [[CCMenuItemImage itemWithNormalImage:@"icon.png" selectedImage:@"icon.png" target:self selector:@selector(doThis:)];

November 8, 2012 at 10:48 am #391779

iKonrad
Participant
@ikonrad

Yeah just like Thomvis said but he also made a mistake as there should be a closing bracket after itemWithNormalImage or something.

November 8, 2012 at 10:54 am #391780

Thomvis
@thomvis

I think you’re trying to call +(id) itemWithNormalImage: (NSString*)value selectedImage:(NSString*) value2 target:(id) r selector:(SEL) s;. My previous post has one opening bracket too much (before CCMenuItemImage), but other than that, it should be fine.

November 10, 2012 at 8:48 am #391781

willingtolearn
Participant
@willingtolearn

thanks so much for the help and the reply!!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.