图片下拉放大

2017-05-04  本文已影响19人  IreneWu
- (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;
}
上一篇下一篇

猜你喜欢

热点阅读