美文网首页Ios@IONIC
如何解决tableView的section header不随ce

如何解决tableView的section header不随ce

作者: Hollylord | 来源:发表于2016-03-11 09:25 被阅读2408次

解决问题的原理

去掉tableview header的黏性

解决办法

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    if (scrollView == self.tableView)
    {
        CGFloat sectionHeaderHeight = **your header hight**;
        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);
        }
    }
}

相关文章

网友评论

    本文标题:如何解决tableView的section header不随ce

    本文链接:https://www.haomeiwen.com/subject/xootlttx.html