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?
Thanks!
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 );
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With