<Span style = "font-size: 14px;"> in the Custom modal pop-up window, because the following code is registered: </span>
<span style="font-size:14px;">void WWDialog::registerWithTouchDispatcher(){cocos2d::CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, kCCMenuHandlerPriority, true);}</span>Therefore, all lower-layer touch events are blocked.
In this case, the following code is added to a pop-up window:
</pre><pre name="code" class="cpp">ui::UILayer* _pLayer = UILayer::create();_pLayer->setPosition(CCPointZero);this->addChild(_pLayer);ui::Widget* _root = GUIReader::shareReader()->widgetFromJsonFile("login_ui_1.json");_pLayer->addWidget(_root);
All the buttons in _ root and the touch events of other components do not respond, and the events are truncated.
Add:
_pLayer->setTouchPriority(kCCMenuHandlerPriority);
Manually set the touch priority to fix the problem.