基于视图的NSTableView viewForTableColumn:row未调用 [英] View based NSTableView viewForTableColumn:row not called
问题描述
我有一个基于视图的 NSTableView
,它在IB中配置为基于视图。其列标识符也已设置。与将其 dataSource
和 delegate
设置为同一对象一样,该对象声称在公共标头中都符合。我已经验证了tableView从它的笔尖醒来后设置的这些。
I've got a View-based NSTableView
which is configured in IB to be View based. Its column identifier is set, too. As are its dataSource
and delegate
set, to the same object, which claims to conform to both in the public header. I've verified these are set after the tableView awakes from its nib.
根据文档,我已经实现了 -numberOfSectionsInTableView:
,它会被调用并返回一个非零数字。
As per the docs, I've implemented -numberOfSectionsInTableView:
and it gets called and returns a non-zero number.
但是, -tableView:viewForTableColumn:row:
令我大为恼火,没有,而且我不知道为什么不这么做。
However, -tableView:viewForTableColumn:row:
, much to my chagrin, does not, and I can't figure out why not.
有人知道为什么会发生这种情况吗?我在Mountain Lion上运行,我的部署目标也设置为Mountain Lion。
Does anyone know why this might happen? I'm running on Mountain Lion and my deployment target is also set to be Mountain Lion.
推荐答案
这很简单!问题是,即使将tableview添加到了我的视图层次结构中,也对其进行了裁剪,因此无法看到。 NSTableView
必须进行一些检查以查看它是否真正在屏幕上,然后仅请求可见行的单元格视图。
It' simple! The problem was, even though the tableview was added to my view hierarchy, it was clipped so it couldn't be seen. NSTableView
must do some checks to see if it's actually on screen and then only request cell views for visible rows.
因为整个tableview本质上是屏幕外的,所以它不会请求任何行。
Because the whole tableview was essentially "off-screen", it wouldn't request any rows.
这篇关于基于视图的NSTableView viewForTableColumn:row未调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!