自定义view里面方imageView,放大ImageView的height
// ImageView的contentMode要设置成这种,这样会让宽度随着高度一起放大
self.headImageView.contentMode = UIViewContentModeScaleAspectFill;
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGPoint point = scrollView.contentOffset;
if (point.y <= 0) {
// 205是图片的原始高度
CGRect rect = ImageView.frame;
rect.origin.y = point.y;
rect.size.height = 205-point.y;
ImageView.frame = rect;
}else {
ImageView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 205);
}
}
网友评论