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

  • 相关阅读:
    Solidity notes
    Solidity by Example详解
    基本命令中部
    基本命令上部
    服务器介绍
    Linux发展史及安装
    ERROR: Unrecognized command line argument: 'use'
    RequireJs 深入理解
    Redis 安装教程 (Windows 2.6.13 稳定版)
    System.AccessViolationException: 尝试读取或写入受保护的内存 解决办法
  • 原文地址:https://www.cnblogs.com/swallow37/p/4686141.html
Copyright © 2011-2022 走看看