kyleplattner
kyleplattner

Reputation: 633

How do I change the UITableView drag controls and behavior?

I am trying to use the the dragging functionality that UITableView offers while in editing mode to rearrange some custom views in the cell.contentView. I am successfully getting editing mode turned on after a long press on the cell and turned off following a reorder.

Here is a picture of how I have things set up: http://cl.ly/image/081k3G0A3f2I

The problems I have are:

  1. The contentView indents no matter what I set ShouldIndentWhileEditing to.
  2. I would like to get rid of the delete control and the drag control.
  3. The whole contentView should be the drag area instead of just the little drag control area.

Help with this would be appreciate. Thanks.

Upvotes: 0

Views: 206

Answers (2)

Mundi
Mundi

Reputation: 80265

Yes, you can customize the look of the drag controls. Try overriding layoutSubviews. In that method, check for editing status and draw /position your elements accordingly.

Upvotes: 1

rmaddy
rmaddy

Reputation: 318804

You can't get rid of the drag control if you have enable row reordering. The API does not allow any customization of row reordering. The only solution would be your own custom table type view.

You can get rid of the delete control. Simply return UITableViewCellEditingStyleNone from the tableView:editingStyleForRowAtIndexPath: delegate method.

Upvotes: 0

Related Questions