I'm dynamically adding rows to an NSTableView. When I issue [table reloadData] I can see the scroll view move and if I move it by hand I can see the new value on the table. But how can I scroll it automatically?
NSInteger numberOfRows = [tableView numberOfRows]; if (numberOfRows > 0) [tableView scrollRowToVisible:numberOfRows - 1];
Assuming you're adding rows to the end of the table.
(The reason I ask the table view for the number of rows instead of the data source is that this number is guaranteed to be the number of rows it knows about and can scroll to.)
Use something like this:
[table scrollRowToVisible:indexOfNewRow];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With