tags:

views:

744

answers:

1

I have a horizontal UIScrollView with a bunch of various pages on it. I would like to programatically show a certain page per a user selection. At the moment, I can't figure out how to start showing it in the middle of the page.

Does anyone have any experience with this? Any help would be greatly appreciated.

Thanks.

Edit: I think I can do this by setting the contentOffset.x of the UIScrollView object. However, the property is not settable. Any advice?

+4  A: 

You'll want to use setContentOffset.

CGFloat offsetX = kPageWidth * pageIndex;
[scrollView setContentOffset:CGPointMake(offsetX, 0)
                    animated:YES];
David Grant