QUICK-COCOS2DX TableView Usage

Source: Internet
Author: User

1. Create TableView

Self.uiranklist = cc. Tableview:create (Cc.size (720, 500))
Self.uiRankList:setDirection (CC. scrollview_direction_vertical)
Self.uiRankList:setPosition (CC.P (0,220))
Self.uiRankList:setVerticalFillOrder (CC. Tableview_fill_topdown)

Parameter description:

TableView the viewable area size is 720*500

Vertical direction of scrolling

Cell fill direction to fall from top

2, need to rewrite the method:

Self.uiRankList:registerScriptHandler (function (table) return END,CC. Number_of_cells_in_tableview)
Self.uiRankList:registerScriptHandler (function (Table,cell) Self:clickcell (Table,cell) end,cc. tablecell_touched)
Self.uiRankList:registerScriptHandler (function (TABLE,IDX) return 720,list_cell_h end,cc. Tablecell_size_for_index)
Self.uiRankList:registerScriptHandler (function (table, IDX) return Self:updatecell (table, idx) end,cc. Tablecell_size_at_index)
Self.uiRankList:registerScriptHandler (function (table) self:scrollviewdidscroll (table) end,cc. Scrollview_script_scroll)

Description

Returns the number of cells

Click the cell's callback function

The size of a cell

Refresh function for cell

TableView scrolling Function callback

3, about TableView

The difference between TableView and Listview,scrollview is that it does not create all the cells, but the visible area can show a few, then create so many more, and when scrolling, the cells are refilled according to the IDX, Then refresh the cell's UI information

To get where TableView scrolled, just call TableView's Getcontentoffset () method, which can be used to fetch data to the server again when the leaderboard is scrolled to the bottom

QUICK-COCOS2DX TableView Usage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.