问题描述
我有一个mac应用程序使用tableView有一些rows.On录音(单击)一个特定的行,我想要的行号。实际上,我想根据所选的行号设置标签的值。请帮助!
I have a mac app that uses tableView that has some rows.On taping(single tap ) a particular row, I want that row number.Actually , I want to set the value of the label based on the row number selected.Please help!
推荐答案
您的表委托可以实现 - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row;
看起来像是给你想要的行,然后只是返回YES
Seems like that'll give you the row you want, then just return "YES" to allow the selection.
或者您的委托可以实现 - (void)tableViewSelectionDidChange:(NSNotification *)notification;
当前选中的单元格(虽然如果允许多选,这可能不够)。
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).
这篇关于在Mac应用程序中单击获取tableView的行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!