Remove the page indicator from UIPageViewController

user1028028 picture user1028028 · Aug 27, 2014 · Viewed 9.8k times · Source

I am using a page view controller in an iOs app. How do I remove the dots from this controller?

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.dontShowChecked = NO;
    self.imagesArray = @[  ..];

    self.textsArray = @[ ........
                        ];


    // Create page view controller
    self.pageViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"WTPageController"];
    self.pageViewController.dataSource = self;

    WTDetailViewController *startingViewController = [self viewControllerAtIndex:0];
    NSArray *viewControllers = @[startingViewController];
    [self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

    // Change the size of page view controller
    CGFloat delta = [[PSDeviceInfo sharedInstance] is_iPhone] ? 50. : 50;

    self.pageViewController.view.frame = CGRectMake(0, 40., self.view.frame.size.width, self.view.frame.size.height - delta);
    [self.view addSubview:_pageViewController.view];
    [self.pageViewController didMoveToParentViewController:self];
}

The dots seem to add themselves automatically and are interfering with other UI elements in that area. How do i Remove them completely?

Answer

Cornelius picture Cornelius · Aug 27, 2014

The dots are added once your UIPageViewController datasource implements the following methods:

presentationCountForPageViewController:
presentationIndexForPageViewController:

Avoid to implement those to get rid of the UIPageControl dots.