Joker,
That worked! Thanks so much for the reply.
However, I now have a new problem. I am creating the buttons in a for loop like this
int pbX = 30;
int pbY = 379;
int z=1001;
for(int y=0;y<8;y++){
for(int x=0;x<6;x++){
Button2 = [CCMenuItemImage
itemFromNormalImage:@"but_patterns_selection.png"
selectedImage: @"but_patterns_selection_sel.png"
target:self selector:@selector(displayPattern:)];
PatternButton = [CCMenu menuWithItems: Button2, nil];
PatternButton.position = ccp(pbX, pbY);
Button2.tag = z;
[self addChild:PatternButton z:2];
pbX = pbX+52;
z++;
}
pbY = pbY-49;
pbX = 30;
}
This creates a grid of buttons in rows and columns. As long as I can set a tag for each button it would work fine to name them all Button2. But now that I am tagging button 2 I need to increment it to: Button2, Button3, Button4....
How do i append my variable z to my variable?
CCMenuItem *[NSString stringWithFormat:@"Button%i",z] = ....................