Chapter 3: IOS Table view delegation protocol and Data Protocol, iostable
Table view has two important protocols
UITableViewDataSource: Data Source Protocol
Method |
Return type |
Description |
Required |
tableView:cellForRowAtIndexPath: |
UITableViewCell* |
Provides data for table View cells. This method is required. |
Yes |
tableView:numberOfRowsInSection: |
NSInteger |
Returns the number of rows in a section. |
Yes |
tableView:titleForHeaderInSection: |
NSString |
Returns the title of the node header. |
No |
tableView:titleForFooterInSection: |
NSString |
Returns the title of the footer. |
No |
numberOfSectionsInTableView: |
NSInteger |
Number of returned sections |
No |
sectionIndexTitlesForTableView: |
NSArray* |
Table view section index title |
No |
tableView:commitEditingStyle:forRowAtIndexPath: |
void |
Provide data for deletion or modification |
No |
UITableViewDelegate: A delegation protocol used to set the header and footer headers in a table view and respond to some action events.
Method |
Return type |
Description |
Required? |
TableView: viewForHeaderInSection: |
UIView * |
Prepare a custom view for the node header. You can use UITableViewHeaderFooterView after iOS 6. |
No |
TableView: viewForFooterInSection: |
UIView * |
Prepare a custom view for the footer. After iOS 6, you can use UITableViewHeaderFooterView |
No |
TableView: didEndDisplayingHeaderView: forSection: |
Void |
This method is triggered when the node header is removed from the screen (the method after iOS 6) |
No |
TableView: didEndDisplayingFooterView: forSection: |
Void |
Triggered when the footer disappears from the screen (after iOS 6) |
No |
TableView: didEndDisplayingCell: forRowAtIndexPath: |
Void |
Triggered when the cell disappears from the screen (the method after iOS 6) |
No |
TableView: didSelectRowAtIndexPath: |
Void |
Method called in response to table view Cell Selection |
No |