個(gè)人很喜歡這種效果,后面會在這個(gè)項(xiàng)目更新新效果迂卢。
版本記錄
2017.1.24 (最基礎(chǔ)圖片下拉放大)
https://github.com/zhaokera/downPhoto
圖片等比放大
_img.contentMode = UIViewContentModeScaleAspectFill;
- (UITableView *)tableView {
_tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.contentInset = UIEdgeInsetsMake(imgH, 0, 0, 0);
_img = [[UIImageView alloc] initWithFrame:CGRectMake(0, -imgH, [[UIScreen mainScreen] bounds].size.width, imgH)];
[_img setImage:[UIImage imageNamed:@"test"]];
_img.contentMode = UIViewContentModeScaleAspectFill;
[_tableView addSubview:_img];
return _tableView;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGPoint point = scrollView.contentOffset;
NSLog(@"pointX=%f,pointY=%f",point.x,point.y);
if (point.y < -imgH) {
CGRect rect = _img.frame;
rect.origin.y = point.y;
rect.size.height = -point.y;
_img.frame = rect;
}
}