- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGFloat yOffset = scrollView.contentOffset.y ;
if (yOffset <0) {
CGRect rect = stretchImgV.frame ;
CGFloat totalOffset = 190 + ABS(yOffset);
CGFloat scale = totalOffset / 190 ;
rect.origin.y = yOffset ;
rect.origin.x = (deviceWidth - deviceWidth * scale)/2 ;
rect.size.width = deviceWidth * scale ;
rect.size.height = totalOffset ;
stretchImgV.frame = rect ;
}
}
注意:stretchImgV是加载在tableheaderView上的子视图,而不是tableheaderView = stretchImgV;