iPhone 标签栏控制器与 UIPageController
我有一个带有“n”个选项卡的 iPhone 选项卡栏应用程序。我想要一个 UIpagecontrol,这样我就可以在选项卡之间滑动。谁能告诉我该怎么做?例子非常有帮助。
非常感谢。
I have an iPhone tabbar application with "n" number tabs. I'd like to have a UIpagecontrol in place so I could swipe between tabs. Could anyone tell me how I could do this? Examples are very helpful.
Much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该仔细检查 UIPageController 是否是根据 iPhone UI 指南执行此操作的正确方法。我认为这更多的是在一个选项卡中包含多个页面,而不是在选项卡之间切换,并且它们通常不一起使用。出现这些白点似乎有点奇怪:)
如果您仍然想在视图之间滑动而不是使用选项卡栏中的按钮,您可以很容易地监听触摸滑动事件,然后当您检测到一个时改变视图。您可以通过实现以下方法来做到这一点:
请参阅 iPhone Cocoa 基础指南,了解如何检测拖动和滑动手势。
You should double check if UIPageController is the correct way to do this with the iPhone UI Guidelines. I think that is more for having several pages in one tab instead of switching between the tabs and that they are not usually used together. Would seem a bit weird to have those white dots appearing :)
If you still want to flick between the views instead of using the buttons in the tab bar you could just quite easily listen for the touch swipe events and change view when you detect one. You can do this by implementing these methods:
See the iPhone Cocoa Fundamentals Guide for how to detect drag and swipe gestures.