Animates multiple insert, delete, reload, and move operations as a group.
- iOS 6.0+
- tvOS 9.0+
The block that performs the relevant insert, delete, reload, or move operations.
A completion handler block to execute when all of the operations are finished. This block takes a single Boolean parameter that contains the value
trueif all of the related animations completed successfully or
falseif they were interrupted. This parameter may be
You can use this method in cases where you want to make multiple changes to the collection view in one single animated operation, as opposed to in several separate animations. You might use this method to insert, delete, reload, or move cells or use it to change the layout parameters associated with one or more cells. Use the block passed in the
updates parameter to specify all of the operations you want to perform.
If the collection view's layout is not up to date before you call this method, a reload may occur. To avoid problems, you should update your data model inside the
updates block or ensure the layout is updated before you call
Deletes are processed before inserts in batch operations. This means the indexes for the deletions are processed relative to the indexes of the collection view’s state before the batch operation, and the indexes for the insertions are processed relative to the indexes of the state after all the deletions in the batch operation.