What I usually do is after configuring the custom cell, I save the NSIndexPath of the cell in the title of the button for the state UIControlStateApplication.
In your tableView: cellForRowAtIndexPath: method, when configuring the cell:
[theButton setTitle:(NSString *)indexPath forState:UIControlStateApplication];
Then, in your button action:
- (IBAction) buttonWasClicked:(UIButton *) senderButton {
NSIndexPath *indexPath;
indexPath = (NSIndexPath *)[senderButton titleForState:UIControlStateApplication];
NSLog(@"Sender button was clicked in cell at NSIndexPath section: %d row: %d ", [indexPath section], [indexPath row]);
}
I am not really happy with this way. If someone has a cleaner way to do it, I would love to hear about it.