UITableViewDelegate 和 UITableViewDatasource 的区别 [英] Difference between UITableViewDelegate and UITableViewDatasource

查看:31
本文介绍了UITableViewDelegate 和 UITableViewDatasource 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我 UITableViewDelegate 和 UITableViewDatasource 的区别?

Anyone tell me the difference between UITableViewDelegate and UITableViewDatasource?

推荐答案

UITableViewDelegate

作为表格的委托人意味着您提供关于表格布局和关于用户在表格视图上执行的操作的请求的答案.Layout 方法包括 tableview 询问行、页眉和页脚的高度、按钮应该是什么样子等.Action 方法包括用户选择一行和开始并结束一行的编辑.

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.
   

用作表格的数据源意味着您为表格的部分和行提供数据,并且您对更改表格数据的消息采取行动.绘制表格时,数据源被要求提供单元格的数据,被告知用户已要求删除一行,并被告知用户已编辑的行的新值.

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆