I want UIScrollView to always scroll back to the specific point. I've achieved it by writing:
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
(*targetContentOffset).x = 0.0f;
}
it works pretty fine with one exception. When I scroll far enough and reach the end of the view (bouncing starts then) and pull my finger up, the view just scrolls smoothly with deceleration a little back, stops and then jumps (without animation) where I set it. It doesn't happen as long as I don't scroll to the end of the scroll view.
Here's how I init UIScrollView
scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 284, frame.size.height)];
scrollView.backgroundColor = [UIColor clearColor];
scrollView.delegate = self;
[scrollView setContentSize:CGSizeMake(285,frame.size.height)];
[self addSubview:scrollView];
UIEdgeInsets inset = scrollView.contentInset;
inset.left = 60;
inset.right = 60;
[scrollView setContentInset:inset];