zoukankan      html  css  js  c++  java
  • 去掉table header footer黏性

    footer黏性:

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView

      

        CGFloat sectionFooterHeight = 30;

        float bottomH = scrollView.contentSize.height - CGRectGetHeight(scrollView.frame) - scrollView.contentOffset.y;

        if (scrollView.contentOffset.y + sectionFooterHeight >= (scrollView.contentSize.height - CGRectGetHeight(scrollView.frame)))

        {

            scrollView.contentInset = UIEdgeInsetsMake(0, 0, -MAX(bottomH, 0), 0);

            NSLog(@"aaaa");

        }

        else if (scrollView.contentOffset.y >= sectionFooterHeight)

        {

            scrollView.contentInset = UIEdgeInsetsMake(0, 0, -sectionFooterHeight, 0);

            NSLog(@"vvv");

        }


    headerview黏性:

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
        CGFloat sectionHeaderHeight = 40;
        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);
        }
    }

    设置table的style为UITableViewStyleGrouped,也能去掉两个的黏性

  • 相关阅读:
    10.19的一些题
    10.18 模拟赛
    bzoj 2212 Tree Rotations
    10.11的一些题
    10.15 模拟赛
    bzoj 5329 战略游戏
    php面向对象基础(二)
    php面向对象基础(一)
    PHP基础-数组与数据结构
    php基础-字符串处理
  • 原文地址:https://www.cnblogs.com/swallow37/p/4686141.html
Copyright © 2011-2022 走看看