Contents

setEditing(_:animated:)

Toggles the table view into and out of editing mode.

Declaration

func setEditing(_ editing: Bool, animated: Bool)

Parameters

  • editing:

    True to enter editing mode; False to leave it. The default value is False.

  • animated:

    True to animate the transition to editing mode; False to make the transition immediate.

Discussion

When you call this method with the value of editing set to true, the table view goes into editing mode by calling setEditing(_:animated:) on each visible UITableViewCell object. Calling this method with editing set to false turns off editing mode. In editing mode, the cells of the table might show an insertion or deletion control on the left side of each cell and a reordering control on the right side, depending on how the cell is configured. (See UITableViewCell for details.) The data source of the table view can selectively exclude cells from editing mode by implementing tableView(_:canEditRowAt:).

See Also

Putting the table into edit mode