版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013163834/article/details/52062602
// 1.
CGFloat img_Height = 150.0f;
_imgView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, img_Height)];
_imgView.image=[UIImage imageNamed:@"wumei"];
[_tableView addSubview:_imgView];
//
UIView *clearView = [[UIView alloc]initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, img_Height)];
_tableView.tableHeaderView = clearView;
// 2. 修改坐标
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGFloat offY = scrollView.contentOffset.y;
if (offY < 0) {
_imgView.frame = CGRectMake(offY/2, offY,self.view.frame.size.width- offY,img_Height- offY);
}
}