I have a UIView
like iPhone's Springboard. I have created it using a UIScrollView
and UIButtons
. I want to disable horizontal scrolling on said scrollview. I want only vertical scrolling. How do I accomplish this?
You have to set the contentSize
property of the UIScrollView
. For example, if your UIScrollView
is 320 pixels wide (the width of the screen), then you could do this:
CGSize scrollableSize = CGSizeMake(320, myScrollableHeight);
[myScrollView setContentSize:scrollableSize];
The UIScrollView
will then only scroll vertically, because it can already display everything horizontally.