Is it possible to change the view shown in response to a left to right “I want to delete this row” swipe in a UITableView’s UITableViewCell?
Currently the ‘delete’ button seems to ignore all of the other UITableViewCell customisation options.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The tricky thing about deleting cells is this: when you swipe left to right to show the “delete” button, the UITableViewCell moves to the
UITableViewCellStateShowingDeleteConfirmationMaskstate, but doesn’t set itsUITableViewCellStateEditingMaskstate. This means you can’t change theaccessoryViewfor the editing state.The way to get around this is to look at the
willTransitionToState:method of UITableViewCell. What you can do is intercept the call to this method that would put your cell in the delete confirmation state and show your own views instead of the “Delete” confirmation button that normally gets shown.For more info, look at the docs for
willTransitionToState:for UITableViewCell.