Frage

I'am using a UIPageViewController with horizontal scrolling... as long as the user scrolls, the UIPageControl works correctly, problem occurs when jumping programmatically to next or previous page

[self.pageViewController setViewControllers:@[[self viewControllerWithIndex:index]] direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:nil];

Than the index of the UIPageControl isn't right (i would provide the index by myself, but cannot access the UIPageViewController's UIPageControl)

- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController {
    return IntroScreensCount;
}

- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController {
    return 0;
}

How to get the current dot index of the UIPageControl right, when changing the UIPageViewController page programmatically?

War es hilfreich?

Lösung

ok, turned out that i misunderstood one delegate method

- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController {
    return [(IntroPageViewController *)[pageViewController.viewControllers firstObject] index];
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top