scrollViewDidScroll:
is the correct method for this. Simple adjust the contentOffset in there.
This example will restrict the top bounce to 20 pixels:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.y < -20) {
scrollView.contentOffset = CGPointMake(0, -20);
}
}
Note that there is a bit of an unnatural delay until the view is scrolled back to 0,0 when the reason for the bounce was a decelerated swipe, and not a drag. But I think there is no way to prevent this. Basically the scrollView still bounces the full way but it doesn't display it.