How can I get the pending view controller value from this method?
-(void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers {
}
What is the code I can use to get the pending view controller value from this array? Any help would be greatly appreciated?
I have tried using this code:
nextIndex = (int)[pendingViewControllers objectAtIndex:0];
But it keeps returning -1 instead of the next or previous value!
The method passes in an array of the pending view controllers, not an index, so you can't cast it to an int. If you want to get the first view controller, you can do it like this,
UIViewController *vc = pendingViewController.firstObject;