去掉UItableview section headerview黏性
UITabelView在style为plain时,在上拉是section始终粘在最顶上而不是跟随滚动而消失或者出现
可以通过设置UIEdgeInsetsMake:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView == self.myTableView) {
CGFloat sectionHeaderHeight = 40;(section头部的高度)
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);
}
}
}