TableView reloadData vs. beginUpdates & endUpdates

前端 未结 3 1027
礼貌的吻别
礼貌的吻别 2020-12-04 18:22

I got a tricky problem regarding updating my TableView, i get different results using different methods of updating it, let me explain:

Situation 1:

3条回答
  •  孤城傲影
    2020-12-04 18:42

    From the UITableView documentation

    beginUpdates
    Begin a series of method calls that insert, delete, or select rows and sections of the receiver.

    That means, you should not use this unless you are inserting, deleting or selecting. You are doing neither of these.

    Also, you should end beginUpdates with endUpdates, not reloadData. Documentation:

    This group of methods must conclude with an invocation of endUpdates.

提交回复
热议问题