Label 是我在UIEditor的ExportJson获取的,因为JSON里写的
{ "classname": "Label", "name": null, "children": ], "options": { "__type": "LabelSurrogate:#EditorCommon.JsonModel.Component.GUI", "classname": "Label", "name": "UserInfoBean", "ZOrder": 0, "actiontag": 18003723, "anchorPointX": 0.5, "anchorPointY": 0.5, "classType": "CocoStudio.EngineAdapterWrap.CSLabel", "colorB": 255, "colorG": 255, "colorR": 255, "customProperty": "", "flipX": false, "flipY": false, "height": 27, "ignoreSize": false, "layoutParameter": null, "opacity": 255, "positionPercentX": 0.189906463, "positionPercentY": 0.0417875424, "positionType": 0, "rotation": 0, "scaleX": 1, "scaleY": 1, "sizePercentX": 0.173958331, "sizePercentY": 0.0421875, "sizeType": 0, "tag": 713, "touchAble": false, "useMergedTexture": true, "visible": true, "width": 167, "x": 182, "y": 26, "areaHeight": 27, "areaWidth": 167, "fontFile": null, "fontName": "微软雅黑", "fontSize": 20, "hAlignment": 0, "text": "开心豆:88888888", "touchScaleEnable": false, "vAlignment": 0 } },
类型是Label 所以我获取控件就强制转换成Label了
Label *name = (Label *) m_userinfo->getChildByName("UserInfoName");
name->setString("昵称:" + player.mNickName);
但是在 name->setString的时候就发生异常了,我在setString()里面加断点,没执行到setString()里面去。
为什么会发生异常呀??