Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c tableView:Mac上的indexPathForCell_Objective C_Macos_Nstableview - Fatal编程技术网

Objective c tableView:Mac上的indexPathForCell

Objective c tableView:Mac上的indexPathForCell,objective-c,macos,nstableview,Objective C,Macos,Nstableview,有没有一种等效的方法来解决这个问题 tableView:indexPathForCell 在Mac上 我正在尝试获取按下按钮的行。尝试使用连接到按钮的此方法。代码需要位于作为表视图委托的类中 -(IBAction)buttonClick:(NSButton *)sender { NSInteger buttonRow = [self.tv rowForView:sender]; //tv is IBOutlet for the tableView NSLog(@"%ld",b

有没有一种等效的方法来解决这个问题

tableView:indexPathForCell 
在Mac上


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

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

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

什么按钮?这是一个基于视图的表,在视图中有一个按钮吗?是的,这是一个基于视图的表,我在行视图中有一个按钮。基本上,我的问题是,如果按下按钮,而行未“选中”,则按钮将对应于选中的行或行-1(无选择)。您可以在NSTableView中尝试“selectedRow”方法。