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

            }

        }

        

    }

  • 相关阅读:
    VS2013 使用QCustomPlot等三方库如何配置
    error LNK1112:模块计算机类型"X64" 与目标计算机类型"X86" 冲突
    Qt 获取屏幕当前分辨率
    流程控制
    导航条和工作内容纪要
    js简介
    高度塌陷
    浮动
    文档流
    display和overflow
  • 原文地址:https://www.cnblogs.com/supersr/p/4877563.html
Copyright © 2011-2022 走看看