Tutorial :ScrollView with selected page



Question:

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?


Solution:1

[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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »