Imagine your IBAction looks like this:
-(IBAction)buttonPressed{
Then you should do this on your deletion:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
To check if your cell has been pressed, you have several ways, for example, if you know the row of your button in the table:
int myCellRow = 5; if (myCellRow == IndexPath.row)
Or you can put the tag in your cell and then check if this is:
#define myTag 5
When creating a cell:
UITableViewCell *myCell = ... myCell.tag = myTag
And in the didSelectRowAtIndexPath file:
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath]; if (selectedCell.tag == myTag)
source share