0

我想创建具有像 UIImagePicker 这样的图像滑动行为的自定义 uiimagepicker,但是当我在一张图像的中间停止滑动时,无法找到将弹跳模式设置为向后或向前反弹的方法。

4

1 回答 1

1
int moveY = reckView.frame.origin.y - parentScrollView.contentOffset.y - parentScrollView.contentInset.top;

if (moveY > 0) {
    [parentScrollView setContentOffset:CGPointMake(0, parentScrollView.contentOffset.y + moveY - reckView.frame.size.height) animated:YES];
} else {
    [parentScrollView setContentOffset:CGPointMake(0, parentScrollView.contentOffset.y + moveY) animated:YES];
}

I think this code will bring you close to your solution. Note that, this will not bounce, instead it will slowly adjust scrollView position.

Here,

parentScrollView is the scrollView.

reckView is the view which contains thumb image.

于 2012-06-08T10:17:18.033 回答