如何在 iPhone 中使用 UIPageControl 将最后一页移动到第一页
我想像 iphone google+ 应用程序的流一样实现页面滑动。
所以当我们滑动最后一页时我想返回到第一页。我尝试使用 UIPageControl
但我无法做到这一点。
所以请给我任何想法。
I want to implement page sliding as in iphone google+ application's stream.
So i want to return to first page when we swipe last page. I tried this using UIPageControl
but I can't do this.
So please give me any idea.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试过 pageControl,我假设您已经下载了 Apple 的 Page Control 示例项目,如果您还没有 ==> http://developer.apple.com/library/ios/ #samplecode/PageControl/Introduction/Intro.html
您将看到这部分代码来处理页码和下一页。并立即加载上一页、当前页和下一页。尝试使用 % 运算符对总页数实施页面计算机制。因此,一旦您到达最后一页,您的下一次计算将为您提供 1。因此,只要您滑动,下一页就会设置为 1。
编辑:
顺便说一句,这只会更改页面指示器,您还应该根据此页面计算加载页面视图。因为它们不会自动绑定到指标。
你可以看到 mod 运算符有多么强大:)
If you have tried pageControl I assume you have downloaded Apple's example project of Page Control if you have not ==> http://developer.apple.com/library/ios/#samplecode/PageControl/Introduction/Intro.html
You are going to see this part of code to handle the page number and the next page. and loads prev current and next pages at once. Try implementing page calculating mechanism with a % operator to you total page number. Therefore as soon as you arrive last page your next calculation will give you 1. So the next page will be set to one as soon as you swipe.
EDIT:
By the way this only changes the page indicator, you should also load the page views according to this page calculation. Because they are not automatically binded to indicator.
You can see how powerful a mod operator is :)