如何从NSOutlineView获取选定的单元格? [英] How can I get the selected cell from a NSOutlineView?

查看:145
本文介绍了如何从NSOutlineView获取选定的单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从NSOutlineView获取选定的单元格?
不是项目,而是单元格。
不是数据单元,而是当前单元本身。

How can I get the selected cell from a NSOutlineView? Not the item, but the cell. Not the datacell but the current cell itself.

这是基于单元的NSOutlineView。

It's a cell based NSOutlineView.

推荐答案

使用委托。 willDisplayCell:在单元格更改其选择状态时被调用。

Use the delegate. willDisplayCell: is called when a cell changes its selection state.

- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item {
    id selectedItem = [outlineView itemAtRow:outlineView.selectedRow];
    if (item == selectedItem) {
        // 'cell' is selected cell for 'tableColumn'
    }
}

这篇关于如何从NSOutlineView获取选定的单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆