Can we customize the page indicator in UIPageViewController?

后端 未结 11 1993
广开言路
广开言路 2020-12-07 17:30

Now it\'s white dots with black background. What about if I want it to be black dots with white backgrounds?

- (NSInteger)presentationCountForPageViewControl         


        
11条回答
  •  暖寄归人
    2020-12-07 18:06

    UIPageControl *pageControl = [UIPageControl appearanceWhenContainedIn:[MyViewController class], nil];
    pageControl.pageIndicatorTintColor = [UIColor whiteColor];
    pageControl.currentPageIndicatorTintColor = [UIColor redColor];
    pageControl.backgroundColor = [UIColor blackColor];
    

    This will change the appearance just for "MyViewController". If you want to have different colors in different page indicators on the same view you have to create different subviews and customize them individually.

提交回复
热议问题