zoukankan      html  css  js  c++  java
  • 关于cocostudio加载UI json CCUIHELPER未声明问题

    查看官方的文档,在文档的最后添加了如何加载项目。如下代码:

    UILayer* ul =UILayer::create();
    ul->addWidget(CCUIHELPER->createWidgetFromJsonFile("UIEditorTest_1.json"));

    但是添加了以后,已经添加相关的头文件及命名空间,无法编译通过,一直是CCUIHELPER是未声明的。

    于是查看TestCpp是如何添加json文件,发现使用的是另外一种方式:

     UILayer* ul =UILayer::create();
     UILayout* layout= dynamic_cast<UILayout*>(GUIReader::shareReader()->widgetFromJsonFile("TestUiApp_1.json"));
     ul->addWidget(layout);

    修改如上面的方式,则可以编译通过,运行成功

  • 相关阅读:
    POJ 2209
    POJ 2196
    POJ 2215
    POJ 2192
    POJ 2195
    POJ 2181
    POJ 2182
    POJ 2159
    POJ 2153
    字符设备驱动 —— 字符设备驱动框架
  • 原文地址:https://www.cnblogs.com/yuan19/p/3442973.html
Copyright © 2011-2022 走看看