0

I need an additional button next to the Delete button when in editing mode of UITableView Cells. Any suggestions for the purpose is appreciated. Thank You.

Syed Absar
  • 2,274
  • 1
  • 26
  • 45

2 Answers2

2

I would suggest you first subclass UITableViewCell. In the respective init method you create the button and add it to the contentView as a subview. Make the button hidden. After that you overwrite layoutSubviews and position the button on your content view by setting the frame property of the button. Then also subclass willTransitionToState: and check if the state is UITableViewCellStateShowingEditControlMask. If that's the case make the button visible. If not hide it.

Note: If you add an additional button to the UITableViewCell you also need to adjust the textLabel frame and other stuff to not overlap the button's rectangle.

Martin Hering
  • 429
  • 3
  • 11
  • Thank you for the response, however It'll be nice to have a sample source code to accept this as an answer. – Syed Absar Jan 17 '11 at 13:22
0
cell.editingAccessoryType = UITableViewCellAccessoryCheckmark;

or some other value than "check"

or

cell.editingAccessoryView = [UIButton buttonWithType:UIButtonTypeInfoDark];

or with some other value than the info button, with it's target set to something appropriate

an accessory view trumps a type

bshirley
  • 8,217
  • 1
  • 37
  • 43