Get the row number of the tableView on single tap in mac app
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).
精彩评论