简体   繁体   English

iOS:带有分页随机的scrollView

[英]IOS: scrollView with a paging random

I have a scrollView and inside this scroll view I have 4 images. 我有一个scrollView,并且在此滚动视图中有4张图像。 It's in paging enabled. 它已启用分页。 But I want to do an IBAction that scroll these images random. 但是我想做一个IBAction随机滚动这些图像。 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 每次更改contentoffset

[scrollView contentOffset:CGSizeMake(totalscrollviewwidth,480];

And find this link also 并找到此链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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