- (void)scrollViewDidScroll:(UIScrollView*)scrollView { if (scrollView == self.tableView) { CGFloat sectionHeaderHeight = HeaderHeight; if (scrollView.contentOffset.y < sectionHeaderHeight && scrollView.contentOffset.y >= - HeaderHeight) { scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); } else if (scrollView.contentOffset.y >= sectionHeaderHeight) { scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); } } }
时间: 2024-10-28 16:11:12