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;

    }

  • 相关阅读:
    Python 使用正则表达式匹配URL网址
    第3章 网络爬虫基础
    《精通Python网络爬虫》
    /etc/hosts
    Linux alias 命令
    file()
    Win10 取消桌面快捷键图标
    Win10 我的电脑 -- 右键点击管理打不开
    MongoDB 备份恢复
    ORACLE 日期比较
  • 原文地址:https://www.cnblogs.com/iOS771722918/p/4853570.html
Copyright © 2011-2022 走看看