做了一个CCLayer层,里面需要触摸操作,于是给这个cclayer注册了触摸事件:
- (void) onEnter{
addTargetedDelegate:self priority:0 swallowsTouches:YES]; ;}
- (void) onExit
{
addTargetedDelegate:self priority:0 swallowsTouches:YES];
;
}
<p> </p>
同时也添加了相关方法:</p>
<p><pre class="brush:cpp; toolbar: true; auto-links: false;">-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
return YES;
}
-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
//...
}
-(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
//...
}
CCLayer层上有CCMenu菜单,给layer层注册触摸之前点击menu正常。注册了触摸之后再点击menu就会崩溃:
Assertion failure in -
请问如何同时保证CCLayer层及其CCMenu的触摸事件正常使用,谢谢!