避免headerView停留在顶部

//去掉UItableview headerview黏性(sticky)

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {

    if (scrollView == _myTab){

          CGFloat sectionHeaderHeight = HEIGHT*100/568; //sectionHeaderHeight

           if

(scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0)       {

      scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y+64, 0, 0, 0);

} else if (scrollView.contentOffset.y>=sectionHeaderHeight) {

scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight+64, 0, 0, 0);

}

}

}

你可能感兴趣的:(避免headerView停留在顶部)