0

enter image description here

This is my cell what I need to achieve is when I tap the icon on left side of my cell it trigger as if the user swipe the cell.

I have a subclass of UITableViewCell also I wired the icon(button). It look like this

- (IBAction)didPressMinusButton:(id)sender {

    [self setEditing:YES animated:YES];

}

In my tableView I also have this

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    //my code for deletion here
}

I would like to achieve when the user tap the icon in left side of my cell I should show the remove or delete. basically like swipe but in this case I just trigger it by tap.

CaffeineShots
  • 2,172
  • 7
  • 33
  • 58

1 Answers1

0

You mean that when user tap on minus icon on left then the remove functionality should work instead of swipe.Right ?

If yes, then just remove this code or make comments for this

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    //my code for deletion here
} 
Nikunj Rajyaguru
  • 196
  • 1
  • 11