tableView reloadData not working

前端 未结 6 1619
小鲜肉
小鲜肉 2021-01-17 07:45

When I call [tableView reloadData] the function - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

6条回答
  •  一生所求
    2021-01-17 08:18

    I spent days debugging this issue, and found a ton of possible fixes. I starred the one that worked for me but they're all valid.

    First, of course, check that your delegate, datasource, IBOutlet, etc are all configured properly.

    **Set the All Exceptions breakpoint and see if you are getting an out of bounds exception in your datasource. Without setting the breakpoint there is no crash and the tableview will simply fail to reload.

    Other possible fixes: check the tableview's frame to make sure the width or height is not 0. Try executing reloadData on the main thread. Lastly, try only reloading a single section (here).

    Gotta love table views.

提交回复
热议问题