With Javascript/Web project this code will work:
@
var Panel_tactics = ccs.UIHelper.seekWidgetByName(this._widget, “Panel_tactics”);
var tableView = cc.TableView.create(this, Panel_tactics.getSize());
tableView.setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL);
tableView.setPosition(Panel_tactics.getPosition());
tableView.setDelegate(this);
Panel_tactics.addChild(tableView);@
cocos2d-html5 error:
Panel_tactics.addChild(tableView); —> Uncaught TypeError: Object # has no method ‘getLayoutParameter’ ;
UIPanel can only add add ui component as child, such as uilabel and uibutton.
UIPanel 如果要添加cc.tableView, 没有其它解决方案?
Try:
var MyLayer = cc.Layer.extend({
uLayer:null,
init:function(){
uLayer = new ccs.UILayer(); //for uilayer
this.addChild(table);
}
});
please in english next time.
我知道原因了:
The addChild method of ccs.Widget can only add widget,
use addNode to add a cc.Node subclass object,like:
谢谢大神回答!!!!
https://github.com/cocos2d/cocos2d-html5/commit/7e98ae42c4b129980238050e5c15af6fbbaf84ec
应该在 2.2.2 版本可以使用 addNode 方法增加 cc.tableView
you are welcome! please write in english next time.