问题
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?
回答1:
ok, turned out that i misunderstood one delegate method
- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController {
return [(IntroPageViewController *)[pageViewController.viewControllers firstObject] index];
}
来源:https://stackoverflow.com/questions/21406833/uipageviewcontroller-setviewcontrollers-uipagecontrol-not-showing-right-current