You can add yourself as an observer (in the sense of NSNotificationCenter, and not in the sense of KVO / Bindings) NSViewBoundsDidChangeNotification from the -enclosingScrollView -contentView table and react based on the visible rectangle as needed.
Update
Do it somewhere (maybe -awakeFromNib):
// Configure the scroll view to send frame change notifications id clipView = [[tableView enclosingScrollView] contentView]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myBoundsChangeNotificationHandler:) name:NSViewBoundsDidChangeNotification object:clipView];
Put this somewhere useful:
- (void)myBoundsChangeNotificationHandler:(NSNotification *)aNotification { if ([aNotification object] == [[tableView enclosingScrollView] contentView]) [self doSomethingInterestingIfDocumentVisibleRectSatisfiesMe]; }
Essentially, you want to view the scroll view -documentVisibleRect to see if the bottom pairs of pixels can be seen. Remember to consider the possibility of viewing with inverted coordinate systems - "inverted views" - in the View Programming Guide .
Joshua nozzi
source share