zoukankan      html  css  js  c++  java
  • iOS下拉放大的效果

    一,code

    // 创建UIImageView

        UIImageView* topView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"IMG_1483"]];

        topView.frame = CGRectMake(0, -HGTopViewH, self.tableView.frame.size.width, HGTopViewH);

        // 设置模式,自动伸缩,全拼显示

        topView.contentMode = UIViewContentModeScaleAspectFill;

        // 支持旋转

        topView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

        // 将UIImageView加到TableView中

        [self.tableView insertSubview:topView atIndex:0];

        // 内嵌

        self.tableView.contentInset = UIEdgeInsetsMake(HGTopViewH*0.5, 0, 0, 0);

        self.topView = topView;

    二,code

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

        // 向下移动的距离

        CGFloat down = -(HGTopViewH*0.5)-scrollView.contentOffset.y;

        

        if (down<0) {

            

            return;

        }

        // 从新设置frame

        CGRect frame = self.topView.frame;

        frame.size.height = HGTopViewH + down*2;

        self.topView.frame = frame;

    }

  • 相关阅读:
    每日一(水)题
    操作树学习笔记
    「THUSCH 2017」大魔法师
    几个规律
    DP专题(DP进阶题单 )
    康托展开&逆康托展开
    一道题目
    P5629 【AFOI-19】区间与除法 题解
    留言板
    NOIP2020考试总结
  • 原文地址:https://www.cnblogs.com/iOS771722918/p/4853570.html
Copyright © 2011-2022 走看看