tableView:Mac上的indexPathForCell

时间:2012-08-14 03:14:22

标签: objective-c macos nstableview

是否有等效的

方法
tableView:indexPathForCell 

在Mac上?

我正在尝试按下按钮的行。

1 个答案:

答案 0 :(得分:2)

尝试使用连接到按钮的此方法。代码需要在类视图的委托中。

-(IBAction)buttonClick:(NSButton *)sender {
    NSInteger buttonRow = [self.tv rowForView:sender]; //tv is IBOutlet for the tableView
    NSLog(@"%ld",buttonRow);
}