我一直在使用UIPageController在不同的控制器之间导航。现在我想在底部添加那个点,这样用户就可以看到他在哪个控制器上。这是通过UIPageControl. 有没有简单的方法可以将这两者结合起来?
			
			11962 次
		
2 回答
            28        
        
		
从 UIPageViewController.h (iOS6+) 的底部~
如果实现了这两种方法,页面指示器将可见,过渡样式为“UIPageViewControllerTransitionStyleScroll”,导航方向为“UIPageViewControllerNavigationOrientationHorizontal”。这两种方法都是为了响应“setViewControllers:...”调用而调用的,但在手势驱动导航的情况下,表示索引会自动更新。
- (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并基本上将它们绑定在一起以使它们保持同步……但是您必须手动完成所有绑定。
于 2012-12-24T00:26:26.970   回答
    
    
            10        
        
		
如果您使用的是 Xcode 的基于页面的应用程序模板,请转到属性检查器并将 Transiton 样式属性设置为 Scroll。
并转到您的应用程序 AppDelegate.m 文件并为
 UIPageControl *pageControl = [UIPageControl appearance];
    pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
    pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
    pageControl.backgroundColor = [UIColor whiteColor]; 
对于基于页面的 Xcode 模板,它已经适用于 iOS 6,iOS 7,只是它的颜色设置为白色。
于 2013-11-30T21:10:43.723   回答