Alex Rivera | Logout

How to stop a UIScrollView at a specific point?

Asked 2012-01-25T12:51:16.030
10

How do you stop a UIScrollView at specific point? That is, set the final position of the UIScrollView after user interaction?

Specifically, how can you set intervals along a horizontal UIScrollView, so that the it will only stop at these points?

I hope what I have said is clear enough.

Edit
Report

2 Answers

2

to achieve this u need to enable the paging of the scrollview

For example:

[scrollView setContentSize:CGSizeMake(640, 161)];
[scrollView setPagingEnabled:YES];

here, width of scrollview is 640 (twice of width of iphone screen), if paging is enabled it will divide it equally depending on the width. So as we scroll to this position it will stop at the particular offset.

answered 2012-01-25T12:59:01.447
0
[scrollView setContentSize:CGSizeMake(640, 161)];
answered 2012-01-25T13:24:03.637

Your Answer