zoukankan      html  css  js  c++  java
  • supersr--去除tableViewHeader的粘性

    这段代码能去除tableViewHeader的粘性

    const static NSInteger kSectionHeaderHeight = 30;

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView

    {

        if (scrollView.contentSize.height > self.view.height) {

            if (scrollView.contentOffset.y<=kSectionHeaderHeight&&scrollView.contentOffset.y>=0) {

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

            } else if (scrollView.contentOffset.y>=kSectionHeaderHeight){

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

            }

        }

    }

    //是不是i7.0

    #define IOS7_OR_LATER   ( [[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending )

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView {

        if (!IOS7_OR_LATER){

            CGFloat sectionHeaderHeight = 53;

            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);

            }

        }

        

    }

  • 相关阅读:
    Fedora/CentOS使用技巧
    Haproxy配置
    iscsi使用教程
    Linux网络配置
    Linux命令使用
    luogu-1908 逆序对 离散化+树状数组
    算法题目签到表
    [笔记-机器学习]贝叶斯分类器的原理及实现
    [笔记-数据结构]树状数组
    [笔记-数据结构]哈希表
  • 原文地址:https://www.cnblogs.com/supersr/p/4877563.html
Copyright © 2011-2022 走看看