auto Nickname = dynamic_cast<Label*>(Helper::seekWidgetByName(m_pLayout,"Label_Nickname"));
返回的是空指针,控件名字肯定没错呀。
用的是3.0beta
auto Nickname = dynamic_cast<Label*>(Helper::seekWidgetByName(m_pLayout,"Label_Nickname"));
返回的是空指针,控件名字肯定没错呀。
用的是3.0beta
检查下编辑器里的类型和你自己写的类型,另看下是否可以用id获取
用tagid也是一样的结果啊。。
{
"classname": "Label",
"name": null,
"children": ],
"options": {
"__type": "ComGUILabelSurrogate:#EditorCommon.JsonModel.Component.GUI",
"classname": "Label",
"name": "Label_Nickname",
"ZOrder": 2,
"actiontag": 36,
"anchorPointX": 0,
"anchorPointY": 0,
"classType": null,
"colorB": 255,
"colorG": 255,
"colorR": 255,
"flipX": false,
"flipY": false,
"height": 0,
"ignoreSize": true,
"layoutParameter": null,
"opacity": 255,
"positionPercentX": 0.101010092,
"positionPercentY": 0.5827505,
"positionType": 0,
"rotation": 0,
"scaleX": 1,
"scaleY": 1,
"sizePercentX": 0.11875,
"sizePercentY": 0.346153855,
"sizeType": 0,
"tag": 25,
"touchAble": false,
"useMergedTexture": true,
"visible": true,
"width": 0,
"x": 80,
"y": 45,
"areaHeight": 0,
"areaWidth": 0,
"fontFile": null,
"fontName": "微软雅黑",
"fontSize": 20,
"hAlignment": 0,
"text": "",
"touchScaleEnable": false,
"vAlignment": 0
}
楼主说下编辑器的具体版本吧`
现在已经是1.2.0.1了。还是一样错误呀
楼主,你先试试这个方法,auto Nickname = dynamic_castgui::Label*(Helper::seekWidgetByName(m_pLayout,“Label_Nickname”));
error C2039: “Label”: 不是“cocos2d::gui”的成员
不能这样用啊
刚看了下,beta版本已经将lable更名为text了。
真吭,能不能不换来换去啊 ,label就是label,text就是text乱搞