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

            }

        }

        

    }

  • 相关阅读:
    精妙SQL语句介绍
    ASP判断文件地址是否有效
    将源代码清空,这样别人就看不到源码了
    部署
    sublime
    vscode
    android node
    mac开启热点
    微信
    常见问题
  • 原文地址:https://www.cnblogs.com/supersr/p/4877563.html
Copyright © 2011-2022 走看看