Reputation: 5918
I am creating a button with CCMenuItem in cocos2d. I want the button image to be change whenever i tap it. Is there anyway to do that at runtime.
Thanks
Upvotes: 0
Views: 951
Reputation: 24846
When creating a CCMenuItemSprite you can specify normal and selected sprite. Just specify them:
CCMenuItemSprite *item = [CCMenuItemSprite itemFromNormalSprite:@"1.png" selectedSprite:@"2.png" target:self selector:@selector(foo)];
Upvotes: 1