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
you can do the following:
NSScrollView* scrollView = [self.tableView enclosingScrollView];
CGRect visibleRect = scrollView.contentView.visibleRect;
NSRange range = [self.tableView rowsInRect:visibleRect];
in the range you will get the location as the first visible cell and in the length the amount of cells are shown so you can know the index of the visible cells.
NSOutlineView
is an NSTableView
subclass. Therefore -rowsInRect:
can be combined with -visibleRect
(from NSView
). Use -levelForRow:
to determine the level.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With