ios - UIPageController 与 UIPageControl 一起使用?

标签 ios uipagecontrol

我一直在使用 UIPageController 在不同的 Controller 之间导航。现在我想在底部添加这些点,这样用户就可以看到他在哪个 Controller 上。这是通过 UIPageControl 实现的。有没有简单的方法可以将这两者结合起来?

最佳答案

从UIPageViewController.h(iOS6+)的底部~

A page indicator will be visible if both methods are implemented, transition style is 'UIPageViewControllerTransitionStyleScroll', and navigation orientation is 'UIPageViewControllerNavigationOrientationHorizontal'. Both methods are called in response to a 'setViewControllers:...' call, but the presentation index is updated automatically in the case of gesture-driven navigation.

- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController NS_AVAILABLE_IOS(6_0); // The number of items reflected in the page indicator.
- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController NS_AVAILABLE_IOS(6_0); // The selected item reflected in the page indicator.

否则,我认为您需要将 UIPageControl 添加到您的 UIPageViewController 并将它们基本上绑定(bind)在一起以保持它们同步...但是您必须这样做所有的手动绑定(bind)。

关于ios - UIPageController 与 UIPageControl 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12916216/

相关文章:

ios - 重新打开后应用程序崩溃

ios - 在用户交互中快速停止 ScrollView 中的自动滚动

ios - UIPageControl + 圆形(无限)滚动

ios - 如何从自定义函数中调用委托(delegate)函数?

objective-c - 如何获得动画 CAEmitterLayer/Cell 的发射器位置?

android - 如何通过点击 Flutter 应用程序中的按钮使用默认应用程序打开 PPT、PDF、文档等?

android - 推送到新屏幕后底部导航栏未隐藏

android - 如何在 iOS 中使用 EXPO/react-native 实现 RTL

objective-c - 如何创建类似应用商店详情页的iOS Nested Scrollview?

objective-c - UIPageControl 加载新 View 或不同的 Controller