Kev*_*vin 23 iphone uitableview
我有一个UITableView,其内容是动态变化的,就像一个FIFO堆栈.将细胞添加到底部并从顶部移除.
这很好用,我可以滚动到indexPath,这样最新的消息总是向下滚动到底部(就像聊天应用程序一样).
现在..我想在该表部分添加一个页脚.而不是使用
SrollToRowAtIndexPath
我希望能够滚动到tableFooterView.
任何想法如何我能做到这一点将不胜感激.
Jes*_*edc 27
滚动UITableView到底部的footerView 的最佳方法是简单地设置内容偏移量.您可以使用contentSize和当前计算底部bounds
这是我的方式.
CGPoint newContentOffset = CGPointMake(0, [self.instanceOfATableView contentSize].height - self.instanceOfATableView.bounds.size.height);
[self.instanceOfATableView setContentOffset:newContentOffset animated:YES];
Run Code Online (Sandbox Code Playgroud)
Ned*_*Ned 27
我使用它滚动到tableView的页脚视图:
[self.tableView scrollRectToVisible:[self.tableView convertRect:self.tableView.tableFooterView.bounds fromView:self.tableView.tableFooterView] animated:YES];
Run Code Online (Sandbox Code Playgroud)
Bej*_*jil 15
感谢iphone_developer,这就是我所做的:
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[tableView numberOfRowsInSection:0]-1 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
Run Code Online (Sandbox Code Playgroud)
然后,当我添加行时,我正在调用它,并且我的tableView的页脚视图保持可见
jun*_*cat 14
这么多糟糕的答案.:-)
最好的方法:
[self.tableView scrollRectToVisible:
self.tableView.tableFooterView.frame animated:YES
];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19026 次 |
| 最近记录: |