问题描述
如何获得NSOutlineView的可见行的索引?
我需要知道哪个级别和哪些行是可见的。
我真正想要的是一个NSOutlineView等效于CocoaTouch / UITableView - (NSArray *)indexPathsForVisibleRows
这种方式我可以使用[outlineview rowAtPoint:point](和类似)获得NSIndexPath。
这个更改要求我做一组这些indexPath所以他们不会得到释放,直到我不需要它们。此外,通常期望模型对象现在需要从索引路径中查找模型对象的所有其他代码。在我的情况下,这是高效的。
How can you get a indexes of visible rows for an NSOutlineView?I need to know which level and which rows are visible.
[EDIT]What I'm actually looking for is an NSOutlineView equivalent to CocoaTouch/UITableView - (NSArray *)indexPathsForVisibleRows
I changed my datasource to return an NSIndexPath for outlineView:child:ofItem:.This way I could use [outlineview rowAtPoint:point] (and similar) to get the NSIndexPath.
This change required me to make a set of these indexPaths so they wouldn't get released until I don't need them. Also, all the other code which normally expected a model object now needs to lookup the model object from the index path. In my case this was efficient.
这篇关于如何获取NSOutlineView的可见行的索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!