如何取消tableView的footer的粘滞效果

footer默认的是固定在底部的  但有时我们需要和view一起滚动 

主要是在scrollViewDidScroll这个代理方法中监听滚动的状况

设置如下

 

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

    CGFloat sectionHeaderHeight = 26;//设置你footer高度  这个值根据你自己的实际情况设置
        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);
        }
    
}

posted @ 2016-09-10 12:08  高晓牛  阅读(2046)  评论(0编辑  收藏  举报