我有一个UIImageView,并且在同样的观点中我有一个UITableView。
我需要获得滚动 y 运动,并且运动应该更新UIImageView.
因此,如果我向上滚动UITableView,UIImage应该降低高度,如果我向下滚动,UIImage应该增加它的高度。
我已经实现了方法scrollViewWillBeginDragging和scrollViewDidScroll委托<UIScrollviewdelegate>,我尝试过使用tableview.contentOffset.y,但是滚动小于UIImageView高度的减少。
它应该是 1:1,所以如果我向上滚动Tableview20px UIImage.frame.size.height -= 20,.
编辑:
这是代码:
在这里我得到了拖动的起点
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
initialframe = _DetailViewTable.contentOffset.y;
NSLog(@"Will begin dragging %f", initial frame);
}
在这种方法中,我应该更新高度,但我不知道该怎么做。
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
NSLog(@"%f", initialframe-_DetailViewTable.contentOffset.y);`
//这里我更新了UIImageView的高度,但是不能正常工作。
_imageView.frame = CGRectMake(_imageView.frame.origin.x, , _imageView.frame.size.width, _imageView.frame.size.height-(initialframe-_DetailTab));
}