delegate and datasource methods for UITableView

后端 未结 12 1649
礼貌的吻别
礼貌的吻别 2020-12-13 00:50

Can anyone list delegate methods and data source methods for UITableView?

Are delegates and data sources methods are same for UITableView?<

12条回答
  •  抹茶落季
    2020-12-13 01:55

    Let me try to explain you in a simple way, the method I used to understand. Delegates simply keeps track of stuff that is done or the actions performed on the cell. While DataSource provides you with the functions that define how the table will look like.

    With that being said functions for delegates are:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{}
    
    • (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath{}

    and DataSource

    -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{}
    

    and

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{}

提交回复
热议问题