我有一个 UITableView
和动态更新的 cells
。除了调用 tableview.reload
(见下文)刷新表格中的 cells
之外,一切正常 我希望表格滚动到底部以显示新的条目。
- (void)reloadTable:(NSNotification *)notification {
NSLog(@"RELOAD TABLE ...");
[customTableView reloadData];
// Scroll to bottom of UITable here ....
}
我本来打算使用 scrollToRowAtIndexPath:atScrollPosition:animated:
但后来发现我无法访问 indexPath
。
有谁知道如何做到这一点,或者我可以使用的 delegate
回调?
最佳答案
用途:
NSIndexPath* ipath = [NSIndexPath indexPathForRow: cells_count-1 inSection: sections_count-1];
[tableView scrollToRowAtIndexPath: ipath atScrollPosition: UITableViewScrollPositionTop animated: YES];
或者您可以手动指定节索引(如果一个节=>索引=0)。
关于iphone - UITableView ,重新加载时滚动到底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5112346/