UITableView的plain样式下,取消区头停滞效果
程序员文章站
2022-03-10 17:37:50
核心代码 ......
核心代码
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat sectionHeaderHeight = sectionHead.height; // 区头高度 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); } }