文档似乎很缺乏,但它涵盖了一个案例:
Deletes are processed before inserts in batch operations. This means@H_301_6@ the indexes for the deletions are processed relative to the indexes of@H_301_6@ the collection view’s state before the batch operation,and the@H_301_6@ indexes for the insertions are processed relative to the indexes of@H_301_6@ the state after all the deletions in the batch operation.
但是,该文档没有讨论何时处理移动.如果我在同一个performBatchUpdates中调用moveItemAtIndexPath和deleteItemsAtIndexPaths,那么移动索引是否应该相对于删除前或删除后的订单? insertItemsAtIndexPaths怎么样?
最后,我遇到了在同一操作中调用reloadItemsAtIndexPaths和moveItemAtIndexPath的问题:
Fatal Exception: NSInternalInconsistencyException attempt to delete@H_301_6@ and reload the same index path
有没有办法在同一个performBatchUpdates中执行我想要的所有操作?如果是,那么更新相对于其他更新的处理顺序是什么?如果没有,人们通常会做什么?在完成所有其他操作后重新加载数据?之前?如果所有的动画都发生在一个阶段,我更喜欢.