Table View Editing
A table view cell has a normal state and an editing state, according to its editing
property. The editing state is typically indicated visually by one or more of the following:
- Editing controls
- At least one editing control will usually appear, such as a minus button (for deletion) at the left side.
- Shrinkage
-
The content of the cell will usually shrink to allow room for an editing control. You can prevent a cell in a grouped-style table from shifting its left end rightward in editing mode by setting its
shouldIndentWhileEditing
to NO, or with the table delegate’stableView:shouldIndentWhileEditingRowAtIndexPath:
. - Changing accessory view
-
The cell’s accessory view will change automatically in accordance with its
editingAccessoryType
oreditingAccessoryView
. If you assign neither, so that they are nil, the cell’s accessory view will vanish when in editing mode.
As with selection, you could set a cell’s editing
property directly (or use setEditing:animated:
to get animation), but you are more likely to let the table view manage editability. Table view editability is controlled through the table view’s editing
property, usually by sending the table the setEditing:animated:
message. The table is then responsible for putting its cells into edit mode.
Note
A cell in edit mode can also be selected by the user if the table view’s allowsSelectionDuringEditing
or allowsMultipleSelectionDuringEditing
is YES. But this would be unusual.
Putting the table into edit mode is usually ...
Get Programming iOS 6, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.