tableCellAtIndex:function (table,idx) {
var cell = table.dequeueCell();
if (!cell) {
cell = new cc.TableViewCell();
//创建小cell
var pnl_cell = this.root.getChildByName("pnl_cell").clone();
pnl_cell.setName("pnl_cell");
pnl_cell.setPosition(cc.p(0,0));
pnl_cell.setVisible(true);
cell.addChild(pnl_cell);
var headIcon = CMF.createHeadIcon("res/icon/gem.png","宝石");
headIcon.setPosition(cc.p(47,66));
pnl_cell.addChild(headIcon);
pnl_cell.getChildByName("btn_choose").setTag(idx);
pnl_cell.getChildByName("btn_choose").addTouchEventListener(this.call_clickAddItem,this);
}
var pnl_cell = cell.getChildByName("pnl_cell"); //单元格控件
pnl_cell.getChildByName("btn_choose").setTag(idx); //必须重新设置tag
return cell;
},
原文链接:https://www.f2er.com/cocos2dx/338179.html