я есть UITable с UITableCells которые выглядят как:кнопка UITableCell touchUpInside с индексом ячейки кнопки WHOS была нажата
[MyLabel MyButton]
[MyLabel MyButton]
[MyLabel MyButton]
[MyLabel MyButton]
Я хотел бы мой handlerCellButtonClicked также получить ссылку на индекс ячейки. Как я могу получить ссылку на этот индекс, а также при нажатии кнопки?
/** 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");
}
возможно дубликат [Детектирование который UIButton прессовали в UITableView] (http://stackoverflow.com/questions/1802707/detecting-which-uibutton-was-pressed-in-a-uitableview) –