CCTableViewDataSource Protocol Reference
Conforms to | NSObject |
---|---|
Declared in | CCTableView.h |
Overview
Protocol for a CCTableView data source. It is similar to but technically incompatible with the UITableViewDataSource protocol.
For complex table views or such cells which are potentially expensive to create it is recommended that the data source caches the cells after creation, so that when tableView:nodeForRowAtIndex: requests a new set of cells the cached cells can be returned rather than creating all cells anew.
– tableView:nodeForRowAtIndex:
required method
Requests a CCTableViewCell for a node at a specific index for the given table view. Should always return a valid cell, ie one created using [CCTableViewCell node]
but it doesn’t necessarily have to have any child nodes.
- (id<CCTableViewCellProtocol>)tableView:(CCTableView *)tableView nodeForRowAtIndex:(NSUInteger)index
Parameters
tableView |
The CCTableView that is requesting a cell for the index. |
---|---|
index |
The index of the cell that is requested. |
Return Value
The CCTableViewCell for the given index.
Declared In
CCTableView.h
– tableViewNumberOfRows:
required method
Requests the number of rows in the given table view.
- (NSUInteger)tableViewNumberOfRows:(CCTableView *)tableView
Parameters
tableView |
The CCTableView for which the number of rows should be returned. |
---|
Return Value
The number of rows in the table view.
Declared In
CCTableView.h
– tableView:heightForRowAtIndex:
Requests the height of a row, in points.
- (float)tableView:(CCTableView *)tableView heightForRowAtIndex:(NSUInteger)index
Parameters
tableView |
The CCTableView requesting with the rows. |
---|---|
index |
The index of the row. |
Return Value
The height (in points) of the row at the given index.
Declared In
CCTableView.h