如何知道我们到达了NSTableView的最后一行 [英] How to know we reached the last row of NSTableView

查看:101
本文介绍了如何知道我们到达了NSTableView的最后一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NSTableView是我用来显示数百万个数据的数据,由于超时而无法响应.

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

所以我决定在页面上说1-100,然后101-200等.

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

所以我的问题从这里开始,我怎么知道我已经到了tableView的末尾或者该单元格是可见的说第100行?

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?

我不想实现 Load More.. 类按钮等.

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:

试图通过服务调用来跟踪scrollView并获取下一组数据.

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

* 它适用于旧鼠标,但滑动失败.

推荐答案

也许您可以确定滚动后的最后一个可见行,我使用此方法将NSTableView子类化了

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

这篇关于如何知道我们到达了NSTableView的最后一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆