iPhone 标签栏控制器与 UIPageController

发布于 2024-08-21 00:17:43 字数 105 浏览 2 评论 0原文

我有一个带有“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

Hello爱情风 2024-08-28 00:17:43

您应该仔细检查 UIPageController 是否是根据 iPhone UI 指南执行此操作的正确方法。我认为这更多的是在一个选项卡中包含多个页面,而不是在选项卡之间切换,并且它们通常不一起使用。出现这些白点似乎有点奇怪:)

如果您仍然想在视图之间滑动而不是使用选项卡栏中的按钮,您可以很容易地监听触摸滑动事件,然后当您检测到一个时改变视图。您可以通过实现以下方法来做到这一点:

(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

请参阅 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:

(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;

See the iPhone Cocoa Fundamentals Guide for how to detect drag and swipe gestures.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文