iOS HeadView不随着cell移动

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

    CGFloat  sectionHeaderHeight =130;

    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);

}}

加这个方法就可以了  那个高度就是你HeadView 的高度

你可能感兴趣的:(iOS HeadView不随着cell移动)