更改tableview的插入时UITableView中的节标题 [英] Section Headers in UITableView when inset of tableview is changed
问题描述
我已经在我的tableView中实现了拉动刷新,如iPhone应用程序Twitter或Facebook。
我的tableView包含带有头部视图的部分。当tableView处于刷新模式时,所以当我拉取tableView进行刷新时,我设置tableView的contentInset以某种方式显示tableView。此时,如果我将tableView向上推,则UITableView的标题不再滚动到UITableView的顶部。请参阅以下屏幕截图:
I have implemented a "Pull to refresh" in my tableView like the iPhone app Twitter or Facebook.
My tableView has sections with head views. When the tableView is in "Refresh mode", so when I pulled the tableView to refresh, I set the contentInset of the tableView to display the tableView a certain way. At this moment, if I push the tableView up, the headers of the UITableView are not anymore scrolling to the top of the UITableView. See the following screenshots:
如何解决这个问题,使标题按预期滚动?
How can I fix that to make the headers scroll like expected?
谢谢!
推荐答案
我在使用contentInset时遇到了同样的问题,并通过向scrollViewDidScroll添加代码来修复它:在加载状态下动态更新contentInset。
I had the same problem when using contentInset and fixed it by adding code to scrollViewDidScroll: to update the contentInset dynamically while in the "loading" state.
if( refreshState == kLoading ) {
if( scrollView.contentOffset.y >= 0 )
scrollView.contentInset = UIEdgeInsetsZero;
else
scrollView.contentInset = UIEdgeInsetsMake( MIN( -scrollView.contentOffset.y, kPullHeight ), 0, 0, 0 );
}
这篇关于更改tableview的插入时UITableView中的节标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!