i have a UITable with UITableCells which look as the following:
[ myLabel myButton ]
[ myLabel myButton ]
[ myLabel myButton ]
[ myLabel myButton ]
I would like my handlerCellButtonClicked to also get a reference to the cell index. How can I get a reference to this index as well when the button is touched?
/** called by table to get the cell needed by the index */
-(UITableViewCell*)tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
...
//init cell
...
//configure the cells custom button handlers
[cell.myButton addTarget:self action:@selector(handlerCellButtonClicked) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
/** handler when the button in the cell is clicked */
- (void)handlerCellButtonClicked{
NSLog(@"cell myButton clicked");
}