- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat sectionHeaderHeight = header的高度;
}
{
CGFloat sectionHeaderHeight = header的高度;
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);}
}
这个方法只能取消headerView的黏性,无法取消footerView的黏性,想要取消footerView的小伙伴只能另寻它法了,可以使用group或者直接在cell上加View,看你们喜好了。