Chapter 3: IOS Table view delegation protocol and Data Protocol, iostable

Source: Internet
Author: User

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

 

 

Related Article

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.