title: How to get pending view controller from method?
body: <p>How can I get the pending view controller value from this method?</p>
  
  <pre><code>-(void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers {
  }
  </code></pre>
  
  <p>What is the code I can use to get the pending view controller value from this array? Any help would be greatly appreciated?</p>
  
  <p>I have tried using this code:</p>
  
  <pre><code> nextIndex = (int)[pendingViewControllers objectAtIndex:0];
  </code></pre>
  
  <p>But it keeps returning -1 instead of the next or previous value!</p>