I added a editButton on the table like this:
self.navigationItem.leftBarButtonItem = self.editButtonItem;
and, having a setEditing method:
- (void) setEditing:(BOOL)editing animated:(BOOL)animated {
[super setEditing:editing animated:animated];
[self.watchListDetailTableView setEditing:editing animated:animated];
if (editing) {
// you might disable other widgets here... (optional)
} else {
// re-enable disabled widgets (optional)
}
}
after I click the edit, I can have a cross and delete button, which method should I do to handle the delete button click? thank you.
This should be it:
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath {
More Info Here
When users tap the insertion (green plus) control or Delete button associated with a UITableViewCell object in the table view, the table view sends this message to the data source, asking it to commit the change. (If the user taps the deletion (red minus) control, the table view then displays the Delete button to get confirmation.) The data source commits the insertion or deletion by invoking the UITableView methods insertRowsAtIndexPaths:withRowAnimation: or deleteRowsAtIndexPaths:withRowAnimation:, as appropriate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With