避免headerView停留在顶部

2016-08-01  本文已影响0人  渴_望

//去掉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);

}

}

}

上一篇下一篇

猜你喜欢

热点阅读