I have NSTableView
with dynamic row heights. I need to scroll to the end. I tried scrollToEndOfDocument:
but it gives same result as scrollRowToVisible:
which is start of last row
- (void)viewDidLoad {
[super viewDidLoad];
//[[self tableView] scrollRowToVisible:[[self tableView] numberOfRows] - 1];
[[self tableView] scrollToEndOfDocument:self];
}
Your scrollRowToVisible
approach should work. Here's a quick sample project that implements variable heights with a button that scrolls to the last row. That last row is fully visible after scrolling.
Update: For table cells larger than the surrounding NSClipView, the above technique will only scroll to the top of the cell. To scroll to the bottom of the last cell, you can use:
let point = NSPoint(x: 0, y: tableView.frame.height)
tableView.scroll(point)
or since OP was in ObjC:
[[self tableView] scrollPoint: NSMakePoint(0, [self tableView].frame.size.height)]