zoukankan      html  css  js  c++  java
  • 新闻详情页顶部的下拉放大与上拉的层叠效果

    条件一:  [self.view insertSubview:_imgView belowSubview:_tableView];

    条件二:

       static NSString *cellId = @"cell1";

                    cell = [tableView dequeueReusableCellWithIdentifier:cellId];

                    if (!cell)

                    {

                        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];

                        cell.selectionStyle = UITableViewCellSelectionStyleNone;

                       //不能重用,且底部要保持透明

                        cell.backgroundColor = [UIColor clearColor];

                        cell.contentView.backgroundColor = [UIColor clearColor];

                    }

    条件三  :- (void)scrollViewDidScroll:(UIScrollView *)scrollview {

        

        CGFloat offsetY = scrollview.contentOffset.y;

        

        if (offsetY > 0) {  //往上滑动改变图片的 y 值

            

            _imgView.top = -offsetY*0.5;

         

            

        } else {

            //向下滑动时放大图片且 y 值保持不变

            

            //原始宽度/原始高度 = 现在宽度/现在高度

            

            //现在的高度

            //ABS()取绝对值

            CGFloat height = SCREEN_WIDTH + ABS(offsetY);

            //现在宽度

            CGFloat width = SCREEN_WIDTH/(CGFloat)SCREEN_WIDTH * height;

            

            topImgFrm = _imgView.frame;

            

            topImgFrm = CGRectMake(-(width-SCREEN_WIDTH)/2.0, 0, width, height);

            

            _imgView.frame = topImgFrm;

            

        }

        

        

    }

    厚积薄发
  • 相关阅读:
    php foreach的使用注意
    php数组遍历 使用foreach
    PHP strip_tags() 函数
    php nl2br() 函数
    php文件上传
    一个网站雏形
    jsp接收相同复合参数 request.getParameterValues()用法
    使用div+css制作简单导航 以及要注意问题
    Java 类与对象
    java 基础
  • 原文地址:https://www.cnblogs.com/yr434/p/4953651.html
Copyright © 2011-2022 走看看