Iphone 从tableCell获取表变量

Iphone 从tableCell获取表变量,iphone,Iphone,我有TableController类用于控制UITableView,TableCell类用于控制自定义单元格 在每个单元格中,我都有一个带有onTouchInside事件的按钮。 我想更新TableController的一些变量 问题是: TableController类中声明的变量不为TableCell类所知 我正在使用接口生成器,所以我有Table.NIB、TableController.h、TableController.m和:TableCell.NIB、TableCell.h、Table

我有TableController类用于控制UITableView,TableCell类用于控制自定义单元格

在每个单元格中,我都有一个带有onTouchInside事件的按钮。 我想更新TableController的一些变量

问题是: TableController类中声明的变量不为TableCell类所知

我正在使用接口生成器,所以我有Table.NIB、TableController.h、TableController.m和:TableCell.NIB、TableCell.h、TableCell.m

如果我将处理“内部修补”事件代码的IBAction方法放在TableController类中,那么如何将Interface Builder中事件的小圆圈从TableController NIB拖到TableCell NIB


或者我应该以编程方式将操作连接到按钮事件吗?

您可以像以下那样连接按钮事件:

    [cell.yourButtonName addTarget:self action:@selector(ButtonAction:) forControlEvents:UIControlEventTouchUpInside];
并管理行动

-(IBAction)ButtonAction:(id)sender{
// perform action 
}