Mac下检测NSTableView的滑动事件的方法
方法一:可以直接在以下这个方法里面做判断,如果rowIndex等于数据源数组的长度的时候就是到底部了
- (id)tableView:(NSTableView *)theTableView objectValueForTableColumn: (NSTableColumn *)theColumn row:(NSInteger)rowIndex
{
if (rowIndex == thirdArr.count-1) {
NSLog(@"id the end");
}
return [[thirdArr objectAtIndex:rowIndex] objectForKey:[theColumn identifier]];
}
方法2:
- (void)windowDidLoad
{
[superwindowDidLoad];
[[NSNotificationCenterdefaultCenter]
addObserver:self
selector:@selector(prepareForNewDisplay:)
name:NSViewBoundsDidChangeNotification
object:[[thirdTableView enclosingScrollView] contentView]]; // table is scrolled
}
- (void)didScroll:(NSNotification *)notification
{
NSLog(@"notification object = %@",[notification object]);
}