开发者

Change button image at runtime in cocos2d

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


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)];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜