views:

3665

answers:

2

i have a view like iphone's springboard . i created it using a scroll view and buttons.i want to disable horizontal scrooling on that view.i want only vertical scrolling.how do i do this?

+7  A: 

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.

Dave DeLong
thank you your method works fine
Rahul Vyas
A: 

if you used interface builder you can select the scrollView and in the inspector there is an option to disable horizontal scrolling.

zPesk