【发布时间】:2012-01-23 12:10:24
【问题描述】:
我有一个带有分页功能的 scrollview 它是一个带有 4 张图片的幻灯片的滚动视图 它可以很好地与用户交互,所以我的问题是我想在没有用户交互的情况下设置这个 scrollview scroll automatique 所以就像酒吧的横幅这是我的代码视图加载:
[UIScrollView beginAnimations:nil context:nil];
[UIScrollView setAnimationDuration:4.0];
[UIScrollView setAnimationDelay:4.0];
[scroller setContentOffset:CGPointMake(320, 98)];
[UIScrollView commitAnimations ];
在这种情况下,卷轴自动工作,但问题是卷轴等待 4 秒,然后转到第二张图像并停止,如果我添加此代码
[UIScrollView beginAnimations:nil context:nil];
[UIScrollView setAnimationDuration:4.0];
[UIScrollView setAnimationRepeatAutoreverses:YES];
[UIScrollView setAnimationRepeatCount:INFINITY];
[UIScrollView setAnimationDelay:4.0];
[scroller setContentOffset:CGPointMake(320, 98)];
[UIScrollView commitAnimations ];
滚动条在显示第二张图片后不会停止 4 秒,因此在这种情况下,如果动画开始后,它会在前 4 秒停止,永远不会停止
所以我的问题是我想这样做:
image 1 ---显示 fo 4 s -----image2 ----显示 4s ----- image3 ----显示 4s ----image 4 ----显示4 s ----- 图像 1 ---- 显示 4 s ...... 像这样自动
因此,如果有人可以帮助我提供示例代码或教程或任何文档,那将非常酷,因为我在 google 中搜索并找到任何东西
【问题讨论】:
标签: iphone objective-c ios ios5