Ios UIPageViewController中缺少页面指示

Ios UIPageViewController中缺少页面指示,ios,ios7,uipageviewcontroller,Ios,Ios7,Uipageviewcontroller,我想使用UIPageViewController对我的数据源进行分页。 从本质上讲,它是有效的,但是我不能把这些点看作是我在哪一页上的指示 以前有人问过这个问题,我完全按照建议做了。但是我的屏幕底部仍然没有任何点 基本上,我使用的是UIPageViewControllerTransitionStyleScroll,导航方向是uipageviewcontrollernavigationorientationhorizone 我在GitHub上创建了一个示例来演示这个问题 如果有人愿意帮忙的话 更新

我想使用
UIPageViewController
对我的数据源进行分页。 从本质上讲,它是有效的,但是我不能把这些点看作是我在哪一页上的指示

以前有人问过这个问题,我完全按照建议做了。但是我的屏幕底部仍然没有任何点

基本上,我使用的是
UIPageViewControllerTransitionStyleScroll
,导航方向是
uipageviewcontrollernavigationorientationhorizone

我在GitHub上创建了一个示例来演示这个问题

如果有人愿意帮忙的话

更新: 请参见下面@senseul的答案。它比这个好

原始答案: 我签出了您的项目,您无法看到
UIPageController
(点)的原因是它的默认颜色是白色,而
UIPageViewController
的视图的超级视图是白色的。要解决此问题,您可以更改背景颜色或更改
UIPageController
的颜色

要将背景色更改为非白色,请在
-viewdiload:
中的
FTAdviceViewController.m
中设置包含
UIPageViewController
视图的视图的背景色

-(void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    ...
}
要更改点的颜色,请在创建
UIPageViewController
后获取
UIPageViewController
UIPageControl
子视图。然后,您可以更改其
pageIndicatorTintColor
currentPageIndicatorTintColor
backgroundColor
属性

- (void)viewDidLoad
{
    ...
    // after creating the UIPageViewController
    for (UIView *subview in self.pageController.view.subviews) {
        if ([subview isKindOfClass:[UIPageControl class]]) {
            UIPageControl *pageControl = (UIPageControl *)subview;
            pageControl.pageIndicatorTintColor = [UIColor yellowColor];
            pageControl.currentPageIndicatorTintColor = [UIColor greenColor];
            pageControl.backgroundColor = [UIColor blueColor];
        }
    }
}

解决此问题的另一种方法是:


我用我在自己的Swift 4项目中使用的这个块回答了前面的SO问题

    override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    for view in self.view.subviews{
        if view is UIPageControl{
            (view as! UIPageControl).currentPageIndicatorTintColor = .yellow
            }
        }
    }

此块中有UIPageControl,因此您可以根据需要对其进行自定义。

谢谢。我没想到它是白色的。考虑到iOS 7默认为带蓝色的白色,他们为
UIPageControl
选择白色是疯狂的。我的荣幸:)当我第一次遇到它时,这也让我感到困惑。谢谢,它也帮助了我。天哪,我觉得自己有多傻?谢谢你,这节省了我很多时间。
    override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    for view in self.view.subviews{
        if view is UIPageControl{
            (view as! UIPageControl).currentPageIndicatorTintColor = .yellow
            }
        }
    }