简体   繁体   中英

IOS: scrollView with a paging random

I have a scrollView and inside this scroll view I have 4 images. It's in paging enabled. But I want to do an IBAction that scroll these images random. How can I do?

#define numPages 4

CGRect frame = scrollView.frame;
frame.origin.x = frame.size.width * (arc4random() % (numPages - 1));
frame.origin.y = 0;
[scrollView scrollRectToVisible:frame animated:YES];

it may be useful to you. every time change the contentoffset

[scrollView contentOffset:CGSizeMake(totalscrollviewwidth,480];

And find this link also

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM