カスタムセル内にUIButtonがあり、ユーザーがそのボタンを押したときにアクションをトリガーしたいのですが、UIButtonが押された行を知る必要があります。
これが私のコードです:
- (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);
}
indexPath を引数としてセレクターに渡すにはどうすればよいですか?