UITableView,滚动到底部重新加载? [英] UITableView , Scroll to bottom on reload?
问题描述
我有一个UITableView与动态更新的单元格。一切工作正常,除了当reload被调用(见下文)刷新cels在表中我希望表滚动到底部显示新的条目。
- (void)reloadTable:(NSNotification *)notification {
NSLog(@RELOAD TABLE ... );
[customTableView reloadData];
//滚动到UITable的底部....
}
我计划使用scrollToRowAtIndexPath:atScrollPosition:animated:但是,然后注意到,我没有访问indexPath。
使用:
NSIndexPath * ipath = [NSIndexPath indexPathForRow:cells_count-1 inSection:sections_count-1];
[tableView scrollToRowAtIndexPath:ipath atScrollPosition:UITableViewScrollPositionTop animated:YES];
也可以手动指定段索引(如果一个段=> index = 0) p>
I have a UITableView with cells that are dynamically updated. Everything works fine apart from when reload is called (see below) to refresh the cels in the table I would like the table to scroll to the bottom to show the new entries.
- (void)reloadTable:(NSNotification *)notification {
NSLog(@"RELOAD TABLE ...");
[customTableView reloadData];
// Scroll to bottom of UITable here ....
}
I was planning to use scrollToRowAtIndexPath:atScrollPosition:animated: but then noticed that I don't have access to an indexPath. Does anyone know how to do this, or of a delegate callback that I could use?
Use:
NSIndexPath* ipath = [NSIndexPath indexPathForRow: cells_count-1 inSection: sections_count-1];
[tableView scrollToRowAtIndexPath: ipath atScrollPosition: UITableViewScrollPositionTop animated: YES];
Or you can specify the section index manually (If one section => index=0).
这篇关于UITableView,滚动到底部重新加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!