Get current UITableview row in couchTableSource

Hi,

I am adding a button as cell accessory view in each row. I want to get selected UITableview row from the below couchTableSource method. How can i get the current table row when checkButtonTapped called?

  • (void)couchTableSource:(CBLUITableSource*)source
    willUseCell:(UITableViewCell*)cell
    forRow:(CBLQueryRow*)row
    {
    [button setFrame:CGRectMake(30, 0, 55, 35)];

    [button setBackgroundImage:[UIImage imageNamed:@“list_area___checkbox___checked”] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(checkButtonTapped:event:) forControlEvents:UIControlEventTouchUpInside];
    NSLog(@“indexPathForSelectedRow: %@”, row);
    //button.tag = [tableView indexPathForSelectedRow].row;
    cell.accessoryView = button;
    }

  • (void)checkButtonTapped:(id)sender event:(id)event{
    // I NEED TO GET THE SELECTED ROW FROM UITABLEVIEW…

    //UIButton *button = (UIButton *)sender;
    }

Use the UITableViewDelegate methods to identify cell selection.
optional public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

Refer to https://developer.apple.com/reference/uikit/uitableviewdelegate

Use
- (nullable UITableViewCell )couchTableSource:(CBLUITableSource)source
cellForRowAtIndexPath:(NSIndexPath *)indexPath;

to create your custom cell .

Got this issue solved using native API