section的headerview或者footerview会黏在屏幕的顶端或者下端,不会跟着tableview一起整体滚动
- (void)scrollViewDidScroll:(UIScrollView *)sender {
if(sender == _myTab) {
CGFloat sectionHeaderHeight = 30;
if (sender.contentOffset.y<=sectionHeaderHeight&&sender.contentOffset.y>=0){
sender.contentInset = UIEdgeInsetsMake(-sender.contentOffset.y, 0, 0, 0);
} else if (sender.contentOffset.y>=sectionHeaderHeight) {
sender.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
}
}
}