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

前端 未结 4 1839
广开言路
广开言路 2021-02-08 20:42

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 NSOutl

4条回答
  •  天命终不由人
    2021-02-08 21:38

    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.

提交回复
热议问题