2

I have a subclassed UITableViewCell and now I also need a custom delete button for this cell. What should I do in this case? Do I add this button in the layoutSubView? I already have my delete button on the nib file of the cell.

What I have now in the custom cell is to show the button in the didTransitionToState:(UITableViewCellStateMask) state. This works, however it shows the delete button. I don't want it to show the delete button and instead I want the user to just press the button to delete the row. How can I do this?

aherlambang
  • 14,290
  • 50
  • 150
  • 253

1 Answers1

2

You can link your custom delete button to the editing accessory view outlet of your cell.

You also need to stop the cell from going into "standard" delete mode, just set it to editing on swipe. There are some details in my related question here : UITableViewCell custom editingAccessoryView - not properly dismissed

And also my answer here : custom editingAccessoryView not working

Community
  • 1
  • 1
jrturton
  • 118,105
  • 32
  • 252
  • 268
  • how do I link my custom delete to the editing accessory view? doesn't setting it to editing on swipe causes the delete button to appear? – aherlambang Nov 05 '11 at 17:08
  • See the second link in my answer for the swipe part. To connect it, it's just like any other outlet. – jrturton Nov 05 '11 at 17:11
  • actually the position of the custom delete button is different than the editing accessory view outlet of my cell, my only issue right now is basically on how to remove that delete button when swiping – aherlambang Nov 05 '11 at 17:31
  • Ok, in that case most of the second link will help you, just don't make the connection in IB. Presumably the custom button only is shown when the cell enters editing mode, you can control this in the setEditing: animated: method of your cell subclass. – jrturton Nov 05 '11 at 17:57