美文网首页
图片下拉放大

图片下拉放大

作者: IreneWu | 来源:发表于2017-05-04 14:54 被阅读19次
    - (void)viewDidLoad {
        [super viewDidLoad];
        
        self.tableView.contentInset = UIEdgeInsetsMake(kTopViewH * 0.5, 0, 0, 0);
        
        UIImageView *topView = [[UIImageView alloc] init];
        topView.image = [UIImage imageNamed:@"aaa"];
        topView.frame = CGRectMake(0, -kTopViewH, kScreenW, kTopViewH);
        topView.contentMode = UIViewContentModeScaleAspectFill;
        [self.tableView insertSubview:topView atIndex:0];
        self.topView = topView;
    }
    
    
    - (void)scrollViewDidScroll:(UIScrollView *)scrollView
    {
        
        CGFloat down = -kTopViewH * 0.5 - scrollView.contentOffset.y;
        NSLog(@"%f", down);
        if (down < 0) return;
        CGRect frame = self.topView.frame;
        frame.size.height = kTopViewH + down;
        self.topView.frame = frame;
    }
    

    相关文章

      网友评论

          本文标题:图片下拉放大

          本文链接:https://www.haomeiwen.com/subject/juzrtxtx.html