title: PageViewController going crazy
body: <p>I want to use <code>PageViewController</code> to page between  viewControllers
  after i followed the tutorial </p>
  
  <p>(it was made for using the <strong>same</strong> viewController with <strong>different</strong> content) but i am paging between four <strong>Different</strong> ViewControllers</p>
  
  <p><strong>The problem</strong> is that sometimes i navigate to a page then it disappears or page to the same page twice
  i found similar questions with no answer :( </p>
  
  <p>here is my code </p>
  
  <pre><code>@implementation MainViewController {
      UIPageViewController *pageViewController;
      int pageIndex;
      NSMutableArray* viewControllers;
  }
  - (void)viewDidLoad {
      [super viewDidLoad];
  
      viewControllers = [NSMutableArray new];
      [viewControllers addObject:[self.storyboard instantiateViewControllerWithIdentifier:@"1"]];
      [viewControllers addObject:[self.storyboard instantiateViewControllerWithIdentifier:@"2"]];
      [viewControllers addObject:[self.storyboard instantiateViewControllerWithIdentifier:@"3"]];
      [viewControllers addObject:[self.storyboard instantiateViewControllerWithIdentifier:@"profileVC"] ];
  
      pageIndex = 3; // starting with the last one
  
      pageViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PageViewController"];
      [pageViewController setDataSource:self];
      pageViewController.delegate = self;
      UIViewController *startVC = viewControllers[3];
      [pageViewController setViewControllers:@[startVC] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil];
  
      pageViewController.view.frame = CGRectMake(0, 120, self.view.frame.size.width, self.view.frame.size.height );
      [self addChildViewController:pageViewController];
      [self.view addSubview:pageViewController.view];
      [pageViewController didMoveToParentViewController:self];
  
  
  }
  - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController{
      if (pageIndex == 0 || pageIndex == NSNotFound) {
  
          return nil;
      }
      return viewControllers[--pageIndex];
  }
  
  - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController{
      if (pageIndex == [viewControllers count] - 1 ) {
          return nil;
      }
      return viewControllers[++pageIndex];
  }
  </code></pre>