group模式的解决方案 - (void)scrollViewDidScroll:(UIScrollView*)scrollView { if (scrollView == self.tableView) { CGFloat sectionHeaderHeight = HeaderHeight; if (scrollView.contentOffset.y < sectionHeaderHeight && scrollView.contentOffset.y >= - HeaderHeight) { scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); } else if (scrollView.contentOffset.y >= sectionHeaderHeight) { scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); } } }
plain模式的解决方案 -(void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat sectionHeaderHeight = ; ) { scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, , , ); } else if (scrollView.contentOffset.y>=sectionHeaderHeight) { scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, , , ); } }