问题描述:
需要在scrollview 中显示item, item的高度由子节点label的高度动态决定,但更改string后,获取label的高度仍为初始值。
解决办法:
//改变string内容
node.getComponent(Label).string = str;
//加上这一句
node.getComponent(Label).updateRenderData(true)
就可以正常输出了
需要在scrollview 中显示item, item的高度由子节点label的高度动态决定,但更改string后,获取label的高度仍为初始值。
//改变string内容
node.getComponent(Label).string = str;
//加上这一句
node.getComponent(Label).updateRenderData(true)
就可以正常输出了