How can you get indexes of visible rows for an NSOutlineView?

NSOutlineView is an NSTableView subclass. Therefore -rowsInRect: can be combined with -visibleRect (from NSView). Use -levelForRow: to determine the level.


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.