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

            }

        }

        

    }

  • 相关阅读:

    类(重要的很)
    异常
    异常
    面向对象oop接口
    面向对象oop多态
    Day10_数组(下)
    Day09_数组(上)
    Day08_网络编程(上)
    Day07_java对象下
  • 原文地址:https://www.cnblogs.com/supersr/p/4877563.html
Copyright © 2011-2022 走看看