开发者

UItableView reloadData reloads table from middle section

开发者 https://www.devze.com 2023-03-17 14:35 出处:网络
A strange thing. After I call [tableView reloadData], cellForRowAtIndexPath being called with indexPath.section = 6 and not = 0. H开发者_StackOverflowow can this be, and how can I fix it?You may want

A strange thing. After I call [tableView reloadData], cellForRowAtIndexPath being called with indexPath.section = 6 and not = 0. H开发者_StackOverflowow can this be, and how can I fix it?


You may want to reset your tableview to the top and then call reload if you want the display to start from the top.

[yourtableview scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:NO];


This is not because of your code . This is by default behavior, execution of cellForRowAtIndexPath starts with last section thats 6 in your case and 0 row for that section.

By the way this does not create any kind of problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消