这段代码能去除tableViewHeader的粘性
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentSize.height > self.view.height) {
if (scrollView.contentOffset.y<=kSectionHeaderHeight&&scrollView.contentOffset.y>=0) {
scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
} else if (scrollView.contentOffset.y>=kSectionHeaderHeight){
scrollView.contentInset = UIEdgeInsetsMake(-kSectionHeaderHeight, 0, 0, 0);
}
}
}
时间: 2024-10-16 05:43:24