At canEditRowAtIndexPath Method, reloadData of UITableView not work properly?

前端 未结 5 779
离开以前
离开以前 2021-01-05 23:05

In my application, I reload my TableView ([tablView reloadData];) after delete row from TableView then canEditRowAtIndexPath Method alway

5条回答
  •  礼貌的吻别
    2021-01-05 23:15

    When it comes to me, I analysed as below:

    As commented by rmaddy on Nitin Gohel's answer:

    1. You should always remove the data from the data source before updating the table.

      I feels this is the ideal way.

    2. If you are going to call reloadData, there is no reason at all to first call deleteRowsAtIndexPath.

      This is also looks correct.

    I analysed ambiguity, if I write reloadData its crashishing but once I write deleteRowsAtIndexPath it worked well.

    Hope someone will emphasise on this issue for its causes etc.

提交回复
热议问题