TableView

来源:互联网 发布:淘宝以前的订单消失了 编辑:程序博客网 时间:2024/05/22 14:20
tableView = cc.TableView:create(cc.size(810, 440))
tableView:setDirection(cc.SCROLLVIEW_DIRECTION_VERTICAL)
tableView:setVerticalFillOrder(cc.TABLEVIEW_FILL_TOPDOWN)
tableView:setColor(cc.c3b(255,255,255))
tableView:setPosition(cc.p(10, 10))
tableView:setDelegate()
imgBk:addChild(tableView)
tableView:registerScriptHandler(function(tableView)
    return 1
end, cc.NUMBER_OF_CELLS_IN_TABLEVIEW)  


tableView:registerScriptHandler(function(tableView, idx)
    return 960, 640
end, cc.TABLECELL_SIZE_FOR_INDEX)


tableView:registerScriptHandler(function(tableView, idx)
    local pDelCell = tableView:dequeueCell()
    while (pDelCell ~= nil) do
        pDelCell:removeAllChildren()
        pDelCell:removeFromParent()
        pDelCell = tableView:dequeueCell()
    end
    local cell = tableView:dequeueCell()
    if cell == nil then
        cell = cc.TableViewCell:create()
        local cellBg = ccui.ImageView:create("ac_bk.png", 1)
        cellBg:setPosition(cc.p(cellWidth / 2.0, cellHeight / 2.0 + 5))
        cellBg:setScale9Enabled(true)
        cellBg:setContentSize(cc.size(cellWidth  - 10,90))
        cell:addChild(cellBg)     
    end
    return cell
end, cc.TABLECELL_SIZE_AT_INDEX) 
tableView:reloadData()




-- tableView:registerScriptHandler(CueResultLayer.scrollViewDidScroll,cc.SCROLLVIEW_SCRIPT_SCROLL)
-- tableView:registerScriptHandler(CueResultLayer.scrollViewDidZoom,cc.SCROLLVIEW_SCRIPT_ZOOM)
-- tableView:registerScriptHandler(CueResultLayer.tableCellTouched,cc.TABLECELL_TOUCHED)
-- tableView:registerScriptHandler(CueResultLayer.cellSizeForTable,cc.TABLECELL_SIZE_FOR_INDEX)
-- tableView:registerScriptHandler(CueResultLayer.tableCellAtIndex,cc.TABLECELL_SIZE_AT_INDEX)
-- tableView:registerScriptHandler(CueResultLayer.numberOfCellsInTableView,cc.NUMBER_OF_CELLS_IN_TABLEVIEW)
-- function CueResultLayer.scrollViewDidScroll(view)
-- end


-- function CueResultLayer.scrollViewDidZoom(view)
-- end


-- function CueResultLayer.tableCellTouched(table,cell)
-- end


-- function CueResultLayer.cellSizeForTable(table,idx) 
--     return 960,640
-- end


-- function CueResultLayer.tableCellAtIndex(table, idx)
    
--     local cell = table:dequeueCell()
--     while ( cell ~= nil ) do
--        cell:removeFromParent()
--        cell = table:dequeueCell()
--     end
   
--     if nil == cell then
--         cell = cc.TableViewCell:new()


--         local propId, propgrade = CueResultLayer:analysisInfo(CueResultLayer.reslutList[idx + 1])




--         local cellBg = ccui.Scale9Sprite:createWithSpriteFrameName("Gray_Bg.png")
--         cellBg:setContentSize(cc.size(CELL_WIDTH, CueResultLayer._cellHeight[idx]))
--         cellBg:setPosition(cc.p(CELL_WIDTH/2, CueResultLayer._cellHeight[idx] / 2))
--         cell:addChild(cellBg)
--     end


--     return cell
-- end


-- function CueResultLayer.numberOfCellsInTableView(table)
--    return 1
-- end
原创粉丝点击