开发者

ScrollView with selected page

开发者 https://www.devze.com 2022-12-10 08:23 出处:网络
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.

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 pa开发者_开发百科ge and next page from initially. How can i do that?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消