区头区尾跟随滑动
- (void)scrollViewDidScroll:(UIScrollView*)scrollView {
CGFloatsectionHeaderHeight =40;
CGFloatsectionFooterHeight =40;
CGFloatoffsetY = scrollView.contentOffset.y;
if(offsetY >=0&& offsetY <= sectionHeaderHeight)
{
scrollView.contentInset=UIEdgeInsetsMake(-offsetY,0, -sectionFooterHeight,0);
}elseif(offsetY >= sectionHeaderHeight && offsetY <= scrollView.contentSize.height- scrollView.frame.size.height- sectionFooterHeight)
{
scrollView.contentInset=UIEdgeInsetsMake(-sectionHeaderHeight,0, -sectionFooterHeight,0);
}elseif(offsetY >= scrollView.contentSize.height- scrollView.frame.size.height- sectionFooterHeight && offsetY <= scrollView.contentSize.height- scrollView.frame.size.height)
{
scrollView.contentInset=UIEdgeInsetsMake(-offsetY,0, -(scrollView.contentSize.height- scrollView.frame.size.height- sectionFooterHeight),0);
}
}