技术的乐趣在于分享,欢迎多多交流,多多沟通。
全部博文(877)
分类: iOS平台
2015-08-24 14:39:40
The UITableViewDataSource
protocol is adopted by an object that mediates the application’?s data model for aUITableView
object. The data source provides the table-view object with the information it needs to construct and modify a table view.
As a representative of the data model, the data source supplies minimal information about the table view’s appearance. The table-view object’s delegate—an object adopting the UITableViewDelegate
protocol—provides that information.
The required methods of the protocol provide the cells to be displayed by the table-view as well as inform theUITableView
object about the number of sections and the number of rows in each section. The data source may implement optional methods to configure various aspects of the table view and to insert, delete, and reorder rows.
Many methods take NSIndexPath
objects as parameters. UITableView
declares a category on NSIndexPath
that enables you to get the represented row index (row
property) and section index (section
property), and to construct an index path from a given row index and section index (indexPathForRow:inSection:
class method). (The first index in each index path identifies the section and the next identifies the row.)
- tableView:cellForRowAtIndexPath:
Required
- tableView:numberOfRowsInSection:
Required