그러면 MyLayer.m 에 다음 코드를 추가하면 된다.
방법 1
-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
}
-(void) ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
}
-(void) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
}
방법 2
-(void) registerWithTouchDispatcher
{
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}
-(BOOL) ccTouchBegan:(UITouch*)touch withEvent:(UIEvent *)event
{
// Always swallow touches, MyLayer is the last layer to receive touches.
return YES;
}
-(void) ccTouchMoved:(UITouch*)touch withEvent:(UIEvent *)event
{
}
-(void) ccTouchEnded:(UITouch*)touch withEvent:(UIEvent *)event
{
}
MyLayer.m 의 -(id) init 에서 touch 가 enable 되어 있어야 한다.
self.isTouchEnabled = YES;
No comments:
Post a Comment