but. Add a target and a callback to the button (I suppose you already did this)
b. In the callback function, loop over the supervisors to find the UITableViewCell, and then find its index, for example:
-(void)deleteButtonPressed:(UIButton*)button { UIView* candidate = button; while (![candidate isKindOfClass:[UITableViewCell class]]) { candidate = candidate.superview; } NSIndexPath* indexPathToDelete = [self.tableView indexPathForCell:cell]; ...
from. Update your model first (very important)
[self.dataArrayThatFeedsTableView removeObjectAtIndex:indexPathToDelete.item]
e. Call the delete line
[self.tableView deleteItemsAtIndexPaths:@[indexPathToDelete]]
Mike m
source share