CATableViewDataSource

2018-09-08 15:43 更新

類說明

CATableView的數(shù)據(jù)代理類,用于定義tableView的數(shù)據(jù)接口。


CATableViewDataSource 方法(點(diǎn)擊查看方法介紹)

方法說明
tableCellAtIndex獲取指定cell
tableViewHeightForRowAtIndexPath獲取指定的cell高度
numberOfRowsInSection獲取對(duì)應(yīng)的section所包含的cell個(gè)數(shù)
numberOfSections獲取tableview包含的section個(gè)數(shù)
tableViewSectionViewForHeaderInSection在tableView中通過索引獲取頭部Section
tableViewHeightForHeaderInSection在tableView中通過索引獲取頭部Section高度
tableViewSectionViewForFooterInSection在tableView中通過索引獲取尾部Section
tableViewHeightForFooterInSection在tableView中通過索引獲取尾部Section高度
tableViewWillDisplayCellAtIndex回調(diào)當(dāng)前將要顯示的tableView


CATableViewDataSource 方法說明

virtual CATableViewCell* tableCellAtIndex(CATableView* table, const DSize& cellSize, unsigned int section, unsigned int row) = 0;

返回值:CATableViewCell* 

參數(shù):

類型參數(shù)名說明
CATableView*table當(dāng)前tableView
const DSize&cellSizecell的size
unsigned intsectioncell所屬的區(qū)域
unsigned introwcell所在行數(shù)

解釋:獲取指定cell


virtual unsigned int tableViewHeightForRowAtIndexPath(CATableView* table, unsigned int section, unsigned int row) = 0;

返回值:unsigned int

參數(shù):

類型參數(shù)名說明
CATableView*table當(dāng)前tableView
unsigned intsectioncell所屬的區(qū)域
unsigned introwcell所在行數(shù)

解釋:獲取指定的cell高度


virtual unsigned int numberOfRowsInSection(CATableView* table, unsigned int section) = 0;

返回值:unsigned int

參數(shù):

類型參數(shù)名說明
CATableView*table當(dāng)前tableView
unsigned intsectioncell所屬的區(qū)域

解釋:獲取對(duì)應(yīng)的section所包含的cell個(gè)數(shù)


virtual unsigned int numberOfSections(CATableView* table);

返回值:unsigned int

參數(shù):

類型參數(shù)名說明
CATableView*table當(dāng)前tableView

解釋:獲取tableview包含的section個(gè)數(shù)


virtual CAView* tableViewSectionViewForHeaderInSection(CATableView* table, const DSize& viewSize, unsigned int section);

返回值:CAView*

參數(shù):

類型參數(shù)名說明
CATableView*table當(dāng)前tableView
const DSize&viewSizeview的size
unsigned intsectioncell所屬的區(qū)域

解釋:在tableView中通過索引獲取頭部Section


virtual unsigned int tableViewHeightForHeaderInSection(CATableView* table, unsigned int section);

返回值:unsigned int

參數(shù):

類型參數(shù)名說明
CATableView*table當(dāng)前tableView
const DSize&cellSizecell的size

解釋:在tableView中通過索引獲取頭部Section高度


virtual CAView* tableViewSectionViewForFooterInSection(CATableView* table, const DSize& viewSize, unsigned int section);

返回值:CAView*

參數(shù):

類型參數(shù)名說明
CATableView*table當(dāng)前tableView
const DSize&viewSizeview的size
unsigned intsectioncell所屬的區(qū)域

解釋:在tableView中通過索引獲取尾部Section


virtual unsigned int tableViewHeightForFooterInSection(CATableView* table, unsigned int section);

返回值:unsigned int

參數(shù):

類型參數(shù)名說明
CATableView*table當(dāng)前tableView
unsigned intsectioncell所屬的區(qū)域

解釋:在tableView中通過索引獲取尾部Section高度


virtual void tableViewWillDisplayCellAtIndex(CATableView* table, CATableViewCell* cell, unsigned int section, unsigned int row) {};

返回值:void

參數(shù):

類型參數(shù)名說明
CATableView*table當(dāng)前tableView
CATableViewCell*cellcell
unsigned intsectioncell所屬的區(qū)域
unsigned introwcell所在行數(shù)

解釋:回調(diào)當(dāng)前將要顯示的tableView


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)