I have added UIButton in UITableViewCells. I have when the user clicks the button we have get the indexpath to use the values from NSMutableA
For a tableview with more than one section a simpler solution would be to assign the tag:
cell.button.tag = indexPath.section * 1000 + indexPath.row
In the event handler use:
let section = sender.tag / 1000
let row = sender.tag % 1000
Note that you need to multiply with a larger number than 1000 if any of your sections can contain 1000 or more rows.