zoukankan      html  css  js  c++  java
  • 往下滚动,导航栏隐藏

    #pragma mark 下拉导航栏隐藏

    // 当开始滚动视图时,执行该方法。一次有效滑动(开始滑动,滑动一小段距离,只要手指不松开,只算一次滑动),只执行一次。

    - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView

    {

        //获取开始位置

        beginContentY = scrollView.contentOffset.y;

    }

    // 滑动scrollView,并且手指离开时执行。一次有效滑动,只执行一次。

    // 当pagingEnabled属性为YES时,不调用,该方法

    - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset

    {

        //获取结束位置

        endContentY = scrollView.contentOffset.y;

        if(endContentY-beginContentY > 100)

        {

            [UIView animateWithDuration:0.25 animations:^{

                CGRect rect = navBarView.frame;

                rect.origin.y = -64;

                navBarView.frame = rect;

                _myTableView.y = navBarView.BottomY;

                 _myTableView.height = SCREENHEIGHT-50;

            }];

            sectionHeaderHeight = 0;

            [_myTableView reloadData];

        } else if(endContentY-beginContentY < -100)  {

            [UIView animateWithDuration:0.25 animations:^{

                CGRect rect = navBarView.frame;

                rect.origin.y = 0;

               navBarView.frame = rect;

             _myTableView.y = navBarView.BottomY;

                _myTableView.height = SCREENHEIGHT-navBarView.height-50;

            } completion:^(BOOL finished) {

                sectionHeaderHeight = 40;

                [_myTableView reloadData];

            }];

        }

    }

  • 相关阅读:
    java学生成绩管理系统
    7.19至7.25第八周学习情况
    8.12至8.18第七周学习情况
    8.5至8.11第六周学习情况
    7.29至8.4第五周学习情况
    《大道至简》读后感
    7.22至7.28第四周学习情况
    7.15至7.21第三周学习情况
    LeetCode 第三题:Longest Substring Without Repeating Characters
    哈希表(散列表)
  • 原文地址:https://www.cnblogs.com/liaolijun/p/6815689.html
Copyright © 2011-2022 走看看