I'm making a menu, and I want one of the buttons to respond when user touch it down, so I made a subclass of CCMenu in order to add cctouchbegan method And manage it there. The problem is that I can make it to respond both things (menuItem & cctouch), is this normal? is there a way to force it to do both things? Thank you in advance, let me know if you need me to put some of the code here
CCMenuItem doesn't respond subclassing and adding cctouch methods to CCMenu
538 views Asked by Oscar At
2
You should look at
CCMenu.m-- it already implementsccTouchBeganand sets a selected flag onCCMenuItems. Your approach is probably not working because you're stealing the messages from your parent class.Your subclass should call
[super ccTouchBegan...]first, then check the selected state of theCCMenuItems to determine which button to change visually.EDIT: Or, even easier! -- Subclass the appropriate
CCMenuItemsubclass (e.g.CCMenuItemSprite) and overload theselectedmethod from it's default to include your visual alterations: