设置seation跟随滑动

2020-07-06  本文已影响0人  IT界的古天乐

// 设置seation跟随滑动

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

    CGFloatsectionHeaderHeight =80;

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

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

    }elseif(scrollView.contentOffset.y>= sectionHeaderHeight) {

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

    }

}

上一篇下一篇

猜你喜欢

热点阅读