Hi,
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?
Hi,
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?
Use something like this:
[table scrollRowToVisible:indexOfNewRow];
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.)