一直报没有成员"TouchEventType "求解

这是头文件
#ifndef HELLOWORLD_SCENE_H
#define HELLOWORLD_SCENE_H

#include “cocos2d.h”
#include “ui/UIWidget.h”
USING_NS_CC;
class HelloWorld : public cocos2d::Layer
{
public:
// there’s no ‘id’ in cpp, so we recommend returning the class instance pointer
static cocos2d::Scene* createScene();

// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
virtual bool init();  
void touchEvent(Ref *pSender, Widget::TouchEventType type);
// a selector callback
void menuCloseCallback(cocos2d::Ref* pSender);

// implement the "static create()" method manually
CREATE_FUNC(HelloWorld);

};

#endif // HELLOWORLD_SCENE_H

我上传了错误图片,怎么没有看到图片呢?

错误图片成功了!

using namespace ui;
void touchEvent(Ref *pSender, TouchEventType type);
```

或者
void touchEvent(Ref *pSender, ui::TouchEventType type);
```

第一种方式还是报错?这是为什么呢?
第二种方式是正确的!
很感谢的!

大神 我是一个新手,可能问的问题很低级!希望你能谅解

这是cpp文件中的
button->addTouchEventListener(CC_CALLBACK_1(HelloWorld::touchEvent, this));

— Begin quote from ____

引用第4楼cocosdemo于2014-08-01 10:15发表的 回 3楼(zx雄) 的帖子 :
第一种方式还是报错?这是为什么呢?
第二种方式是正确的!
很感谢的! http://www.cocoachina.com/bbs/job.php?action=topost&tid=218298&pid=1018770

— End quote

第一种方法是加上命名空间,要写在class外面的

参考下这里第三种吧http://cn.cocos2d-x.org/tutorial/show?id=76

CC_CALLBACK_1(HelloWorld::touchEvent, this)
改成
CC_CALLBACK_2(HelloWorld::touchEvent, this)
你试下行不行,2是代表两个参数链接的文章也有介绍

错了,addTouchEventListener要求两个参数

对呀 我是有两个参数呀 CC_CALLBACK_2(HelloWorld::touchEvent, this)

void Widget::addTouchEventListener(Ref *target, SEL_TouchEvent selector)
{
    _touchEventListener = target;
    _touchEventSelector = selector;
}
    
void Widget::addTouchEventListener(Widget::ccWidgetTouchCallback callback)
{
    this->_touchEventCallback = callback;
}


```


这是源码,应该用上面的重载。
addTouchEventListener要求两个参数。我给的链接你进去看看