Jarryd Jarryd - 1 year ago 100
iOS Question

Disabling vertical scrolling in UIScrollView

There is an option in IB to uncheck vertical scrolling on a scrollview, but it doesnt seem to work.

How can the scrollview be set to only scroll horizontally, and not vertically in the code rather than IB?

Answer Source

Try setting the contentSize's height to the scrollView's height. Then the vertical scroll should be disabled because there would be nothing to scroll vertically.

scrollView.contentSize = CGSizeMake(scrollView.contentSize.width,scrollView.frame.size.height);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download