美文网首页Tableview
TableView plain方式下header不悬浮

TableView plain方式下header不悬浮

作者: 吞风吻雨葬落日未曾彷徨 | 来源:发表于2016-05-18 14:50 被阅读782次
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    if (scrollView == self.tableView)
    {
        CGFloat sectionHeaderHeight = 20;
        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 plain方式下header不悬浮

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