我一直在使用 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/