How to know we reached the last row of NSTableView

非 Y 不嫁゛ 提交于 2019-12-19 08:54:02

问题


NSTableView is what I am using to display millions of data, which I can not get in response due to time out.

So what I decided to get response in pages say 1-100 then 101-200 etc.

So my problem starts here, how can I know that I have reached to the end of tableView or the cell is visible say 100th row?

I dont want to implement Load More.. kind of button etc.

After this I will send a new response with new range.


Here is what I have tried so far:

Tried to track the scrollView and get next set of data by a service call.

*It works with old mouse but it failed with swipe.


回答1:


Maybe you can determine the last visible row after a scroll, I've a subclassed NSTableView with this method

@interface MyTableView : NSTableView
- (NSInteger)lastVisibleRow;
@end


@implementation MyTableView
    - (NSInteger)lastVisibleRow {
        NSRect bounds = [[self superview] bounds];
        bounds.origin.y += bounds.size.height - 1;
        return [self rowAtPoint:bounds.origin];
    }

@end


来源:https://stackoverflow.com/questions/17235552/how-to-know-we-reached-the-last-row-of-nstableview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!