cocos2d 模态窗口与 CCLayer
尝试用CCLayer实现模态窗口。我的模态视图层被添加为另一个层的子层。
在我的模态视图层上,我添加了方法(启用触摸):
-(void) registerWithTouchDispatcher
{
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
return YES;
}
为什么模态视图层不吞没我的触摸?
Trying to implement a modal window with CCLayer. My modal view layer is added as a child of another layer.
On my modal view layer I've added methods(the touch is enabled):
-(void) registerWithTouchDispatcher
{
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
}
-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
return YES;
}
Why the modal view layer it doesn't swallos my touches?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将优先级设置为-129。菜单具有最低优先级(kCCMenuTouchPriority = -128)。只需尝试以下代码:
try to set priority to -129. Menu have lowest priority (kCCMenuTouchPriority = -128). Just try this code: