1 //去掉UItableview headerview黏性 2 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 3 if (scrollView == self.tableView) 4 { 5 CGFloat sectionHeaderHeight = 30; 6 if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) { 7 scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); 8 } else if (scrollView.contentOffset.y>=sectionHeaderHeight) { 9 scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); 10 } 11 } 12 }