O'Reilly logo

Programming iOS 4 by Matt Neuburg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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’s tableView:shouldIndentWhileEditingRowAtIndexPath:.
Changing accessory view
The cell’s accessory view will change automatically in accordance with its editingAccessoryType or editingAccessoryView. If you assign neither, so that they are nil, the cell’s accessory view will vanish when in editing mode.

As with selection, you can 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’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 is YES. But this would be unusual.

Putting the table into edit mode is usually left up to the user. One typical device ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required