UITableView cellForRowAtIndexPath called more than once for each row

前端 未结 3 558
青春惊慌失措
青春惊慌失措 2021-01-18 05:54

If I have a UITableView that has 4 rows in it then shouldn\'t the cellForRowAtIndexPath method be called 4 times when I navigate to that view? I am finding that it is being

3条回答
  •  不思量自难忘°
    2021-01-18 06:32

    Highly probable that you are calling from other methods :

    UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
    

    self.tableView from outside of - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath will call cellForRowAtIndexPath twice.

提交回复
热议问题