Section HeaderView

使用下列代码来控制headerView随tableView的滚动而滚动


CGFloat sectionHeaderHeight = 44;
    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);
    }else{
        scrollView.contentInset = UIEdgeInsetsMake(240, 0, 0, 0);
    }

你可能感兴趣的:(Section HeaderView)