Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between UITableViewDelegate and UITableViewDatasource

Anyone tell me the difference between UITableViewDelegate and UITableViewDatasource?

like image 699
krishna Babu Avatar asked Apr 19 '11 09:04

krishna Babu


1 Answers

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.

like image 136
Matthew Frederick Avatar answered Oct 13 '22 10:10

Matthew Frederick