请把代码粘贴在这里
```
开发环境为 w7 VS2012,cocotudio2.0,cocos2dx3.3。
如图,在一个imageView上放了一个Button.
在代码中分别给两个时间加入监听事件
Button * backBtn = dynamic_cast(node->getChildByName("Button_1"));
backBtn->addClickEventListener(CC_CALLBACK_1(HelloWorld::returnBtnCallback,this));
auto * touchImg = dynamic_cast(node->getChildByName("touchImg"));
touchImg->addClickEventListener(CC_CALLBACK_1(HelloWorld::touchImgCallback,this));
前面开了多点触控
this->setTouchEnabled(true);
this->setTouchMode(Touch::DispatchMode::ALL_AT_ONCE);
EventDispatcher * eventDispatcher = Director::getInstance()->getEventDispatcher();
auto listen = EventListenerTouchAllAtOnce::create();
listen->onTouchesBegan = CC_CALLBACK_2(HelloWorld::onTouchesBegan,this);
listen->onTouchesMoved = CC_CALLBACK_2(HelloWorld::onTouchesMoved,this);
listen->onTouchesEnded = CC_CALLBACK_2(HelloWorld::onTouchesEnded,this);
listen->onTouchesCancelled = CC_CALLBACK_2(HelloWorld::onTouchesCancelled,this);
eventDispatcher->addEventListenerWithSceneGraphPriority(listen,this);
问题来了:我点击按钮能正常回调,点击图片没有回调,调用的是多点触控的onTouchesBegan和onTouchesEnd。
为什么两个控件的不一样?
还有一个问题就是开启多点触控以后,我点击一下屏幕都会触发onTouchesBegan、onTouchesEnd两次。安卓真机上也一样。
touchImg->setEnabled(true);