//去掉UItableview headerview黏性
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == self.tableView)
{
CGFloat YOUR_HEIGHT = 20.0f;
CGFloat sectionHeaderHeight = YOUR_HEIGHT;
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);
}
}
}
//去掉UItableview footerview黏性
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == self.tableView)
{
CGFloat sectionFooterHeight = SECTION_FOOTOR_HEIGHT;
if (scrollView.contentOffset.y < sectionFooterHeight) {
scrollView.contentInset = UIEdgeInsetsMake(0, 0, -sectionFooterHeight, 0);
} else if (scrollView.contentOffset.y >= sectionFooterHeight && (scrollView.contentOffset.y >= scrollView.contentSize.height)) {
scrollView.contentInset = UIEdgeInsetsMake(0, 0, -scrollView.contentOffset.y, 0);
}
}
}
//去掉UItableview footerview黏性
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == self.tableView)
{
CGFloat sectionFooterHeight = SECTION_FOOTOR_HEIGHT;
if (scrollView.contentOffset.y < sectionFooterHeight) {
scrollView.contentInset = UIEdgeInsetsMake(0, 0, -sectionFooterHeight, 0);
} else if (scrollView.contentOffset.y >= sectionFooterHeight && (scrollView.contentOffset.y >= scrollView.contentSize.height)) {
scrollView.contentInset = UIEdgeInsetsMake(0, 0, -scrollView.contentOffset.y, 0);
}
}
}