解决方法如下:
if (scrollView.contentOffset.y >= 0 && scrollView.contentOffset.y <= pushNewsTableViewHeaderViewHeight) {
scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
}else if (scrollView.contentOffset.y >= pushNewsTableViewHeaderViewHeight){
scrollView.contentInset = UIEdgeInsetsMake(-pushNewsTableViewHeaderViewHeight, 0, 0, 0);
}
在这里pushNewsTableViewHeaderViewHeight为headerView的高度