Issue scrolling table view with content inset
Posted
by
Rog
on Stack Overflow
See other posts from Stack Overflow
or by Rog
Published on 2010-12-06T10:12:40Z
Indexed on
2011/01/03
2:53 UTC
Read the original article
Hit count: 225
Hi all,
I am experiencing a weird scrolling issue and I was hoping someone could give me a hand in trying to identify why this is happening.
I have included the part of my code that I think is relevant to the question but am happy to update this post with whatever else is needed.
I have implemented a pull to refresh view in the tableview's content inset area. The refresh fires an Async NSURLConnection that pulls data from a webserver, parses the relevant information and refreshes the table as required.
This is where the refresh process kicks off:
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
if (scrollView.contentOffset.y <= - 65.0f && !self.reloading) {
self.reloading = YES;
[self reloadTableViewDataSource];
[refreshHeaderView setState:EGOOPullRefreshLoading];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.2];
self.tableView.contentInset = UIEdgeInsetsMake(60.0f, 0.0f, 0.0f, 0.0f);
[UIView commitAnimations];
}
}
Problem is if I start to scroll whilst the content inset is "visible" (i.e. during reload) I get this weird behaviour where my table sections do not scroll all the way to the top - see screenshot for a clear visual of what I am trying to describe here.
I have included a couple of screenshots below that clearly identify what is happening at the moment.
Has anyone experienced this before? Any ideas on what I should be looking at to try and fix it?
Many thanks in advance, Rog
And this is the result if I start scrolling the table. The orange bit at the top of the image is the actual navigation bar, where I would expect the table section (date 1 December 2010) to be.
© Stack Overflow or respective owner