尝试这个..
UIButton *btn = [[[UIButton alloc]init]autoerelease];
btn .frame = CGRectMake(210.0, 0.0, 90, 25);
btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[UIImage imageNamed:@"loginN.png"] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(btnClickHandler:) forControlEvents:UIControlEventTouchUpInside];
[cell.contentView addSubView: btn];
并在 btnClickHandler 中执行此操作以获取 indexPath
- (void)btnClickHandler :(UIButton *)button {
UITableViewCell *cell = (UITableViewCell *)button.superview.superview;
NSIndexPath *indexPath = [tableView indexPathForCell:cell];
//Get your data source object from indexPath.row.
}