"self.isTouchEnabled = YES;
in the init function of the layer you want touch recognition. Then outside of the init function you have to write:
-(void) registerWithTouchDispatcher {
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event{
return true;
}
//this function is optional
-(void) ccTouchEnded:(NSSet *)touches withEvent:(UIEvent *)event{
//your code here
}
}
Seems a bit unnecessary :/
No comments:
Post a Comment