-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    
    CGFloat sectionHeaderHeight = section的高度;
    if (scrollView.contentOffset.y <= sectionHeaderHeight && scrollView.contentOffset.y> 0) {
        scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
    }else{
        if(scrollView.contentOffset.y >= sectionHeaderHeight){
            scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
        }
    }
}

参考:

https://www.jianshu.com/p/8d1d1d7ae904

 

https://blog.csdn.net/lizhilin_vip/article/details/51275032

posted on 2021-08-30 10:03  懂事长qingzZ  阅读(73)  评论(0编辑  收藏  举报