美文网首页iOS、OC
改变tableview section headerView 的

改变tableview section headerView 的

作者: Heikki_ | 来源:发表于2018-02-28 15:45 被阅读76次
#pragma mark <UIScrollViewDelegate>
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    self.naviView.alpha = scrollView.contentOffset.y/400;
    
// change the position of section header when scrolled by changing scroll's contentInset
    CGFloat sectionHeaderHeight = 64;
    CGFloat ceilPositon = CGRectGetHeight(_subTitleView.frame)-sectionHeaderHeight;
    if (scrollView.contentOffset.y < sectionHeaderHeight){
        scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
    }
    // the "scrollView.contentOffset.y" must larger than its position to ceiling
    if (scrollView.contentOffset.y>=ceilPositon && scrollView.contentOffset.y>=sectionHeaderHeight) {
        scrollView.contentInset = UIEdgeInsetsMake(sectionHeaderHeight, 0, 0, 0);
    }
}

http://blog.csdn.net/axllll/article/details/50502475

相关文章

网友评论

    本文标题:改变tableview section headerView 的

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