I have been struggling with this issue for the last few days and after all this juggling I have figured out that all I need is the current Index from the datasource method to up
I am facing the same issue on pageViewController, everytime i swipe my pageViewController it calls my delegate twice and am not able to find the issue. And my array is dynamic so i want the proper index value from pageController. First of all set the delegate of your pageViewController. Like this :-
self.pageViewController.delegate = self;
And then add this delegate method to your class
- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed
{
if (completed) {
NSInteger currentIndex = ((PageContentViewController *)self.pageViewController.viewControllers.firstObject).pageIndex;
NSLog(@"%ld",(long)currentIndex);
}
}
PageContentViewController is the class where you are showing your data of pageViewController.
Run your project and if everything is working fine, you will get your index value. PageIndex is the Integer value for getting the current index. Hope it will helps you.
Thanks
Mandeep Singh