indexPath.row for IBAction Button in a Custom Cell

to get the indexPath.row for a IBAction Button in your Custom Cell simply do this

/**
* 1. Connect the Button from the Custom Cell to your ViewController.h as IBAction
* 2. add the following code to your ViewController.m
*/
 
- (IBAction)buildButton:(id)sender forEvent:(UIEvent *)event {
 
    UIButton *button = (UIButton *)sender;
    UITableViewCell *cell = (UITableViewCell *)button.superview;
    UITableView *tableView = (UITableView *)cell.superview;
    NSIndexPath *indexPath = [tableView indexPathForCell:cell];
 
    NSLog(@"IBAction Button selected row %d", indexPath.row);
}

output

  2013-03-24 12:45:54.519 cppApp[6017:c07] IBAction Button selected row 2