Instead of enable and disable touch, handle through bool value.
In class.h file declare this
bool mAllowTouch;
In Init/onEnter :
-(void)onEnter
{
[super onEnter];
mAllowTouch = true;
self.userInteractionEnabled = true;
}
In your function
-(BOOL)ccPhysicsCollisionPreSolve
{
if(YOUR_CONDITION_TO_STOP_TOUCH)
{
mAllowTouch = false;
}
else
{
mAllowTouch = true;
}
}
In touch function, use mAllowTouch to process your touch.
-(void) touchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
if(mAllowTouch)
{
//handle touch here.
}
}