سؤال

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?

هل كانت مفيدة؟

المحلول

ok, turned out that i misunderstood one delegate method

- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController {
    return [(IntroPageViewController *)[pageViewController.viewControllers firstObject] index];
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top