UITableView的plain样式下,取消区头停滞效果

时间:2023-03-09 13:04:22
UITableView的plain样式下,取消区头停滞效果

核心代码

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

  CGFloat sectionHeaderHeight = sectionHead.height; // 区头高度
  if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=){
    scrollView.contentInset= UIEdgeInsetsMake(-scrollView.contentOffset.y,,,);
  } else if(
    scrollView.contentOffset.y>=sectionHeaderHeight) {
    scrollView.contentInset= UIEdgeInsetsMake(-sectionHeaderHeight,,,);
  }
}