开发者

Get the row number of the tableView on single tap in mac app

开发者 https://www.devze.com 2023-03-19 00:13 出处:网络
I have a mac app that uses tableView that has some rows.On taping(single tap ) a particular row, I开发者_JAVA技巧 want that row number.Actually , I want to set the value of the label based on the row

I have a mac app that uses tableView that has some rows.On taping(single tap ) a particular row, I开发者_JAVA技巧 want that row number.Actually , I want to set the value of the label based on the row number selected.Please help!


Your table delegate can implement - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row;

Seems like that'll give you the row you want, then just return "YES" to allow the selection.

Or your delegate could implement - (void)tableViewSelectionDidChange:(NSNotification *)notification; and then get the currently selected cell (though if you allow multiple selection this might not be sufficient).

0

精彩评论

暂无评论...
验证码 换一张
取 消