个人很喜欢这种效果,后面会在这个项目更新新效果。
版本记录
2017.1.24 (最基础图片下拉放大)
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;
}
}