I have a UIButton inside my custom cell and I want to trigger an action when the user presses that button BUT I need to know from which row the UIButton was pressed.
Here is my code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
[self configureCell:cell atIndexPath:indexPath];
return cell;
...
[button addTarget:self action:@selector(buttonPressedAction:)forControlEvents:UIControlEventTouchUpInside];
}
- (void)buttonPressedAction:(UIButton *)button
{
//int row = indexPath.row;
//NSLog(@"ROW: %i",row);
}
How do I pass the indexPath as argument to my selector?