发生的事情是我有一个分段视图控件,当我切换段时,我将使用不同的数据重新加载我的tableview。在这种情况下,一个部分将重新加载30+,另一个部分重新加载11个。 在滚动和来回切换时发现了这个问题,它达到了寻找索引30的程度,但是我的数组中只有11个对象。如果我不是很快这样做,那很好。 在重新加载表之前滚动到顶部没有帮助。
查看我的日志并注意模式,最后一个日志显示在cellforRow之前没有调用numberOfrows
我试过调用在主线程上重新加载表的方法,等到完成。
我还尝试在重新加载之前滚动到顶部。
问题似乎是当我快速滚动并切换到新细分时。
日志按此顺序排列: 1.在排列数据之前,这是我点击该段的时间 2.在我安排数据并交换数组之后 3.在numberOfRows中 4.在cellforRows中。
最后一个序列跳过了第三步。
2014-05-09 15:58:06.193 [2991:8407] Employees had 0
2014-05-09 15:58:06.216 [2991:8407] Employees has 11 rows after arrangeData
2014-05-09 15:58:06.216 [2991:60b] Returning 11 in numberOfRowsInSection
2014-05-09 15:58:06.217 [2991:60b] Looking for index 0 with employee count of 11
2014-05-09 15:58:06.227 [2991:60b] Looking for index 1 with employee count of 11
2014-05-09 15:58:06.236 [2991:60b] Looking for index 2 with employee count of 11
2014-05-09 15:58:06.244 [2991:60b] Looking for index 3 with employee count of 11
2014-05-09 15:58:06.971 [2991:60b] Employees had 11
2014-05-09 15:58:07.030 [2991:60b] Employees has 26 rows after arrangeData
2014-05-09 15:58:07.031 [2991:60b] Returning 26 in numberOfRowsInSection
2014-05-09 15:58:07.032 [2991:60b] Looking for index 0 with employee count of 26
2014-05-09 15:58:07.034 [2991:60b] Looking for index 1 with employee count of 26
2014-05-09 15:58:07.036 [2991:60b] Looking for index 2 with employee count of 26
2014-05-09 15:58:07.038 [2991:60b] Looking for index 3 with employee count of 26
2014-05-09 15:58:07.525 [2991:60b] Looking for index 4 with employee count of 26
2014-05-09 15:58:07.564 [2991:60b] Looking for index 5 with employee count of 26
2014-05-09 15:58:07.577 [2991:60b] Looking for index 6 with employee count of 26
2014-05-09 15:58:07.641 [2991:60b] Looking for index 7 with employee count of 26
2014-05-09 15:58:07.675 [2991:60b] Looking for index 8 with employee count of 26
2014-05-09 15:58:07.708 [2991:60b] Looking for index 9 with employee count of 26
2014-05-09 15:58:07.758 [2991:60b] Looking for index 10 with employee count of 26
2014-05-09 15:58:07.791 [2991:60b] Looking for index 11 with employee count of 26
2014-05-09 15:58:07.841 [2991:60b] Looking for index 12 with employee count of 26
2014-05-09 15:58:07.908 [2991:60b] Looking for index 13 with employee count of 26
2014-05-09 15:58:07.958 [2991:60b] Looking for index 14 with employee count of 26
2014-05-09 15:58:08.042 [2991:60b] Looking for index 15 with employee count of 26
2014-05-09 15:58:08.125 [2991:60b] Looking for index 16 with employee count of 26
2014-05-09 15:58:08.225 [2991:60b] Looking for index 17 with employee count of 26
2014-05-09 15:58:08.341 [2991:60b] Looking for index 18 with employee count of 26
2014-05-09 15:58:08.450 [2991:60b] Employees had 26
2014-05-09 15:58:08.483 [2991:60b] Employees has 11 rows after arrangeData
2014-05-09 15:58:08.485 [2991:60b] Returning 11 in numberOfRowsInSection
2014-05-09 15:58:08.487 [2991:60b] Looking for index 7 with employee count of 11
2014-05-09 15:58:08.490 [2991:60b] Looking for index 8 with employee count of 11
2014-05-09 15:58:08.492 [2991:60b] Looking for index 9 with employee count of 11
2014-05-09 15:58:08.494 [2991:60b] Looking for index 10 with employee count of 11
2014-05-09 15:58:10.282 [2991:60b] Employees had 11
2014-05-09 15:58:10.329 [2991:60b] Employees has 26 rows after arrangeData
2014-05-09 15:58:10.330 [2991:60b] Returning 26 in numberOfRowsInSection
2014-05-09 15:58:10.331 [2991:60b] Looking for index 7 with employee count of 26
2014-05-09 15:58:10.334 [2991:60b] Looking for index 8 with employee count of 26
2014-05-09 15:58:10.336 [2991:60b] Looking for index 9 with employee count of 26
2014-05-09 15:58:10.338 [2991:60b] Looking for index 10 with employee count of 26
2014-05-09 15:58:10.624 [2991:60b] Looking for index 11 with employee count of 26
2014-05-09 15:58:10.674 [2991:60b] Looking for index 12 with employee count of 26
2014-05-09 15:58:10.690 [2991:60b] Looking for index 13 with employee count of 26
2014-05-09 15:58:10.741 [2991:60b] Looking for index 14 with employee count of 26
2014-05-09 15:58:10.775 [2991:60b] Looking for index 15 with employee count of 26
2014-05-09 15:58:10.808 [2991:60b] Looking for index 16 with employee count of 26
2014-05-09 15:58:10.842 [2991:60b] Looking for index 17 with employee count of 26
2014-05-09 15:58:10.892 [2991:60b] Looking for index 18 with employee count of 26
2014-05-09 15:58:10.941 [2991:60b] Looking for index 19 with employee count of 26
2014-05-09 15:58:10.991 [2991:60b] Looking for index 20 with employee count of 26
2014-05-09 15:58:11.042 [2991:60b] Looking for index 21 with employee count of 26
2014-05-09 15:58:11.108 [2991:60b] Looking for index 22 with employee count of 26
2014-05-09 15:58:11.175 [2991:60b] Looking for index 23 with employee count of 26
2014-05-09 15:58:11.266 [2991:60b] Employees had 26
2014-05-09 15:58:11.294 [2991:60b] Employees has 11 rows after arrangeData
2014-05-09 15:58:11.296 [2991:60b] Looking for index 24 with employee count of 11