title: Using View Controller from storyboard programmatically in a Page View Controller
body: <p>I have an app with a storyboard. I am using several View Controller with segues to choose from a table view depending on the item selected. I want to have a page view controller in which the pages will be one or more view controller from the storyboard, even repeating them. I am trying to <code>init</code> the Page View Controller like this:
      ....
      self.dataSource=self;</p>
  
  <pre><code>UIViewController *initialViewController =[self viewControllerAtIndex:current];
  NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];
  
  
  [self setViewControllers:viewControllers direction:UIPageViewControllerNavigationOrientationHorizontal  animated:NO completion:nil];
  ....
  
  - (UIViewController *)viewControllerAtIndex:(NSUInteger)index
  {
  if ((descriptions.count == 0) ||
      (index &gt;= descriptions.count)) {
      return nil;
  }
  
  current=index;
  
  // Create a new view controller and pass suitable data.
  NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
  
  Description *description=[DBCompany getDescriptionById:language descriptionId:[[descriptions objectAtIndex:index] integerValue]];
  
  UIViewController *viewController=nil;
  if(description.frame==100){
      viewController=[[Company100ViewController alloc] init];
      ((Company100ViewController*)viewController).companyId = companyId;
  }
  return viewController;
  }
  
  - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
  {
  if ((descriptions.count == 0) ||
      (current-1 &lt; 0)) {
      return nil;
  }
  
  return [self viewControllerAtIndex:current-1];
  }
  
  - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
  {
  if ((descriptions.count == 0) ||
      (current &gt;= descriptions.count)) {
      return nil;
  }
  
  return [self viewControllerAtIndex:current+1];
  }
  </code></pre>
  
  <p>However the <code>viewcontroller</code> appears in black. I think is because I am adding the <code>UIviewcontroller</code> class but not connecting it to any view, XIB, in my case with the storyboard.</p>
  
  <p>How can I use the different view controller from the storyboard programmatically to use in a page view controller?</p>