去除表视图section的粘性问题

//  去除section的粘性

 

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

    

    if (scrollView == self.tableView) {

        

        CGFloat sectionHeaderHeight = 36;

        

        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 on 2016-04-07 13:23  玉思盈蝶  阅读(173)  评论(0编辑  收藏  举报

导航