title: UIPageViewController with multiple UIViewController with header and bottom bar
body: <p>I did a <code>UIPageViewController</code> with multiple <code>UIViewController</code>. And now, I need to add a fixed <code>UIView</code> in top and in bottom in <code>UIPageViewController</code>...</p>
  
  <p>There's my code: </p>
  
  <pre><code>   - (void)viewDidLoad
  {
      [super viewDidLoad];
  
      // Create it.
      self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
  
      // Point the datasource back to this UIViewController.
      self.pageController.dataSource = self;
  
      // Assuming you have a SomePageViewController which extends UIViewController so you can do custom things.
  
  
      UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
      if(!self.roteirosView)
          self.roteirosView = [sb instantiateViewControllerWithIdentifier:@"RoteirosView"];
  
      self.initialViewControllers = [NSArray arrayWithObject:self.roteirosView];
  
      // animated:NO is important so the view just pops into existence.
      // direction: doesn't matter because it's not animating in.
      [self.pageController setViewControllers:self.initialViewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
  
      // Tell the child view to get ready
      [self.pageController willMoveToParentViewController:self];
  
      // Actually add the child view controller
      [self addChildViewController:self.pageController];
  
      // Don't forget to add the new root view to the current view hierarchy!
      [self.view addSubview:self.pageController.view];
  
      // And make sure to activate!
      [self.pageController didMoveToParentViewController:self];
  }
  
  - (void)viewDidLayoutSubviews {
  }
  
  - (UIViewController *)viewControllerAtIndex:(int)i {
      // Asking for a page that is out of bounds??
      if (i&lt;0) {
          return nil;
      }
      if (i&gt;=MAX_PAGES) {
          return nil;
      }
  
      // Assuming you have SomePageViewController.xib
      UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
  
      if (i == 0) {
          if(!self.roteirosView)
              self.roteirosView = [sb instantiateViewControllerWithIdentifier:@"RoteirosView"];
          return self.roteirosView;
      }
      else {
          if(!self.pertoView)
              self.pertoView = [sb instantiateViewControllerWithIdentifier:@"PertoView"];
          return self.pertoView;
      }
  }
  
  
  - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController {
      UIViewController *p = (UIViewController *)viewController;
      if ([p isKindOfClass:[PertoViewController class]]) {
          return [self viewControllerAtIndex:0];
      }
      else {
          return [self viewControllerAtIndex:MAX_PAGES]; // permanece na mesma página
      }
  
  }
  
  
  - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController {
      UIViewController *p = (UIViewController *)viewController;
      if ([p isKindOfClass:[PertoViewController class]]) {
          return [self viewControllerAtIndex:MAX_PAGES]; // permanece na mesma página
      }
      else {
          return [self viewControllerAtIndex:1];
      }
  }
  </code></pre>
  
  <p>In my <code>UIStoryBoard</code> I have HomesViewController which is my <code>UIPageViewController</code>, PertoViewController and RoteirosViewController. Both <code>UIViewControllers</code> add in <code>UIPageViewController</code>. </p>