1. 程式人生 > >下拉tableView,Headview圖片左右擴充套件

下拉tableView,Headview圖片左右擴充套件

// 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(00,self.view.frame.size.widthimg_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);

    }

}