faisal
faisal

Reputation: 475

ScrollView with selected page

I have a scrollViewWith size width=320x10 and height=460. I add 10 images of size width=320 and height=460 in scrollview with paging enabled. Now I can scroll the from 1st image to 10th image by scrolling.

when scrollView show, it is always showed from the 1st page. I want to show initially any random page of the scrollView, such that i can scroll previous page and next page from initially. How can i do that?

Upvotes: 2

Views: 1104

Answers (1)

Chris Gummer
Chris Gummer

Reputation: 4782

[scrollView setContentOffset: CGPointMake(0, y) animated: YES];

You should just need to set the y variable to the point where you would like to scroll to. For example:

[scrollView setContentOffset: CGPointMake(0, 920) animated: YES];

Should scroll to your 3rd image.

Upvotes: 7

Related Questions