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,也能去掉两个的黏性

  • 相关阅读:
    一些手打的笔记
    字符集的相关知识
    Java的概述以及语法
    Java和eclipxe的安装以及第一个程序
    制作Html标签以及表单、表格内容
    2,8,10,16进制之间的转换
    验证日期时间
    验证输入一个月的31天
    验证输入一年的12个月
    身份证号验证
  • 原文地址:https://www.cnblogs.com/swallow37/p/4686141.html
Copyright © 2011-2022 走看看