As there has been no activity on this thread I post my original comment as a reply as I am pretty sure this is the solution to the problem of the thread starter:
indexPathForRow uses a CGPoint to determine the corresponding cell indexPath. The point you are using sender.convert(CGPoint.zero, to: self.tableView) where sender is your button, which corresponds to the top left point of your button in tableView coordinates. This point probably is not in the cell you want it to be. So make sure your button has the appropriate frame or transform the point you use to be in the appropriate cell after transformation (maybe you want to project it onto the cell's contentView frame).
Also: The CGPoint you use for indexPathForRow needs to be in the contentView of the appropriate cell, so for example a point with negative x value won't work. Again, projecting the point onto the appropriate cell's contentView frame should help in that case.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: