How do I stop a UIScrollView from bouncing horizontally?

scrollView.bounces = NO;

Worked for me.


That's strange, because whenever I create a scroll view with frame and content size within the bounds of the screen on either dimension, the scroll view does not scroll (or bounce) in that direction.

// Should scroll vertically but not horizontally
UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
scrollView.contentSize = CGSizeMake(320, 1000);

Are you sure the frame fits completely within the screen and contentSize's width is not greater than the scroll view's width?


The checkbox for bounce vertically in storyboard-scrollview can simply help...

enter image description here