title: How can I dismiss/pop a UIPageViewController after the last view controller is swiped?
body: <p>How can I dismiss/pop a UIPageViewController after the last view controller is swiped?
  Basically want to make a tutorial style paging view with images, and to dismiss after the user swipes to the "next" page from the last.</p>
  
  <pre><code>- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController {
  
      NSUInteger index = [(EmailTutorialViewController *)viewController index];
  
  
      index++;
  
      if (index == 5) {
          [self.navigationController popViewControllerAnimated:YES]; // this doesn't do anything
          return nil;
      }
  
      return [self viewControllerAtIndex:index];
  }
  </code></pre>