Instance Method

deleteRowsAtIndexPaths:withRowAnimation:

Deletes the rows specified by an array of index paths, with an option to animate the deletion.

Declaration

- (void)deleteRowsAtIndexPaths:(NSArray<NSIndexPath *> *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;

Parameters

indexPaths

An array of NSIndexPath objects identifying the rows to delete.

animation

A constant that indicates how the deletion is to be animated, for example, fade out or slide out from the bottom. See UITableViewRowAnimation for descriptions of these constants.

Discussion

When this method is called in an animation block defined by the beginUpdates and endUpdates methods, UITableView defers any insertions of rows or sections until after it has handled the deletions of rows or sections. This order is followed regardless how the insertion and deletion method calls are ordered. This is unlike inserting or removing an item in a mutable array, in which the operation can affect the array index used for the successive insertion or removal operation. For more on this subject, see Batch Insertion, Deletion, and Reloading of Rows and Sections in Table View Programming Guide for iOS.

See Also

Inserting, Deleting, and Moving Rows and Sections

insertRowsAtIndexPaths:withRowAnimation:

Inserts rows in the table view at the locations identified by an array of index paths, with an option to animate the insertion.

moveRowAtIndexPath:toIndexPath:

Moves the row at a specified location to a destination location.

insertSections:withRowAnimation:

Inserts one or more sections in the table view, with an option to animate the insertion.

deleteSections:withRowAnimation:

Deletes one or more sections in the table view, with an option to animate the deletion.

moveSection:toSection:

Moves a section to a new location in the table view.

performBatchUpdates:completion:

Animates multiple insert, delete, reload, and move operations as a group.

beginUpdates

Begins a series of method calls that insert, delete, or select rows and sections of the table view.

endUpdates

Concludes a series of method calls that insert, delete, select, or reload rows and sections of the table view.