iOS视频开发

改变tableview section headerView 的

2017-06-07  本文已影响14人  大老虎_Robin
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {// any offset changes
    
    // change the position of section header when scrolled by changing scroll's contentInset
    CGFloat sectionHeaderHeight = 0;
    
    CGFloat ceilPositon = CGRectGetHeight(self.headerView.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);
    }
}
上一篇 下一篇

猜你喜欢

热点阅读