【已解决】cocostudio button BUG 无法修改title

版本号:1.4.0.1

button 调用setTitleText方法报错···

auto layer = GUIReader::getInstance() -> widgetFromJsonFile(“PlayPage.json”);
this -> addChild(layer,0);
Button* currentBtn =(Button*) layer->getChildByName(“btnList”)->getChildByName(“currentL”);
currentBtn->setTitleText(Value(5).asString());
代码执行到这里就报错了···原因是_titleRenderer这个东西是NULL。所有跟title相关的方法都报错···原因都一样···

我试过了手动创建的Button控件能正常使用···但是通过cocostudio获取到的button就要报错···
Button* btn=Button::create("");

btn->setTitleText("");

向上面手动创建的···就不会报错··求解···

感谢反馈,我们正在测试该问题,如果确实有问题我们会第一时间修复。

你好,经过测试我们未发现button不能设置文本。建议您检查是否是因为未正确获取到对象导致的。

如果您使用的是Cocos2d-x 3.0版本,获取控件请使用UIHelper类去获取控件。

在lua中设置Button没效果 请问怎么回事

local ul = TouchGroup:create()
ul:addWidget(GUIReader:shareReader():widgetFromJsonFile(“res/ccs/ccs_main_bg_1/ccs_main_bg_1.ExportJson”))
self:addChild(ul)

local tempBtn = ul:getWidgetByName("Button_39")
-- tempBtn:setString("100")
print(tolua.type(tempBtn))
-- tempBtn:setText("1000")
tempBtn:setTitleText("1")

已解决 命名重复了