I've got an UIImageView
and in the same view I've got an UITableView
.
I need to get the scroll y movement and the movement should update the height of UIImageView
.
So if I scroll up the UITableView
, the UIImage
should reduce the height, if I scroll it down, the UIImage
should increment its height.
I've already implemented the methods scrollViewWillBeginDragging
and scrollViewDidScroll
delegating <UIScrollviewdelegate>
, I've tried to work with tableview.contentOffset.y
, but The scroll is less than the reduce of UIImageView
's height.
It should be a 1:1, so if I scroll up the Tableview
for 20px, UIImage.frame.size.height -= 20
.
EDIT:
Here's the code:
Here I get the starting point of dragging
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
initialframe = _DetailViewTable.contentOffset.y;
NSLog(@"Will begin dragging %f", initial frame);
}
In this method I should update the height, but i don't know how to do it.
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
NSLog(@"%f", initialframe-_DetailViewTable.contentOffset.y);`
//Here I update UIImageView's height, but it doesn't work properly.
_imageView.frame = CGRectMake(_imageView.frame.origin.x, , _imageView.frame.size.width, _imageView.frame.size.height-(initialframe-_DetailTab));
}