UITableViewDelegate和UITableViewDatasource之间的区别 [英] Difference between UITableViewDelegate and UITableViewDatasource
问题描述
UITableViewDelegate
作为表的代表,您可以提供关于表格的布局的请求以及用户在表视图上执行的操作的答案。 布局方法包括表格查询行,页眉和页脚的高度,按钮的外观等等。操作方法包括用户选择行和开始并结束编辑一行。
UITableViewDatasource
作为表的数据源,您可以提供部分和行的数据的表格,而您对更改表格数据的邮件采取行动。在绘制表格时,要求数据源提供单元格的数据,被告知用户要求删除一行,并被告知用户已编辑的行的新值。
Anyone tell me the difference between UITableViewDelegate and UITableViewDatasource?
UITableViewDelegate
Serving as a table's delegate means you provide answers to requests about the layout of the table and about actions the user performs on the tableview. Layout methods include the tableview asking about the height of rows, headers, and footers, what the buttons should look like, etc. Action methods include the user selecting a row and beginning and ending the editing of a row.
UITableViewDatasource
Serving as a table's datasource means you provide data for the sections and rows of a table and you act on messages that change a table's data. The datasource is asked for the data for a cell when the table is drawn, is told that the user has asked to delete a row, and is told the new value of a row that the user has edited.
这篇关于UITableViewDelegate和UITableViewDatasource之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!