Skip to content

Instantly share code, notes, and snippets.

@wpsteak
Forked from sergiosvieira/gist:6439169
Created April 16, 2014 04:13
Show Gist options
  • Save wpsteak/10805976 to your computer and use it in GitHub Desktop.
Save wpsteak/10805976 to your computer and use it in GitHub Desktop.
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat sectionHeaderHeight = 40;
if (scrollView.contentOffset.y <= sectionHeaderHeight
&& scrollView.contentOffset.y>=0)
{
scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
}
else if (scrollView.contentOffset.y >= sectionHeaderHeight)
{
scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment