- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat sectionHeaderHeight = 65;
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);
}
if(first==0){ //first为全局变量
first++;
NSIndexPath *selectIndexPath = [NSIndexPath indexPathForRow:0 inSection:12];
[self.collectionView scrollToItemAtIndexPath:selectIndexPath atScrollPosition:UICollectionViewScrollPositionTop animated:NO];
}
}
如何让UITableview的sectionHeader随着tableview一起滑动
最新推荐文章于 2025-07-06 15:46:59 发布