You should set it to INT_MIN+1, not 1, if you want it to swallow all the touches.
BOOL buttonTouched;
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
buttonTouched = [self.menu ccTouchBegan:touch withEvent:event];
return YES;
}
-(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
if(buttonTouched) [self.menu ccTouchEnded:touch withEvent:event];
}
-(void) ccTouchCancelled:(UITouch *)touch withEvent:(UIEvent *)event
{
if(buttonTouched) [self.menu ccTouchCancelled:touch withEvent:event];
}
-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
if(buttonTouched) [self.menu ccTouchMoved:touch withEvent:event];
}
- (void)registerWithTouchDispatcher {
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:INT_MIN+1 swallowsTouches:YES];
}
This is of course assuming you have a CCMenu *menu set up with a property to access self.menu in those methods. You would then have to put your own swiping code in here, and do whatever you need to get the behavior you want.
To deactivate a menu item, you call [item setIsEnabled:NO]. You can supply an inactive state sprite for CCMenuItemSprite to show the player that the button is not working right now.