title: Integrating UIPageViewController in existing app with UITableViewController & UINavigationController
body: <p>I'm having an issue integrating a UIPageViewController into my existing app. I've got a simple UITableViewController with a list of items. Tapping one brings up a detail view. I'd just like to let the user swipe from detail view to detail view (pretty common). I followed this to start: <a href="http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/" rel="nofollow">http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/</a>.</p>
  
  <p>With a tableview, would I simply wire a cell to segue to the PageViewController and use my existing detail VC as the "content" or "data" view controller?</p>
  
  <p>UPDATE 1:
  I've got the basics working, I can see my content on the detail view and swipe between items. Everything besides the data passing doesn't work though. The big issue is the nav controller. When I'm shown my detail view, I technically see a nav bar with a back button, but it doesn't have any of the buttons i add in viewdidload (using [self.navigationController.navigationBar addSubview:addButton]). The barbuttonitem I add doesn't show either (i read about passing navitem as property, but i still there's other issues). The content is up under the nav bar (fixable with frame adjustments, but it just makes me think something isn't right). After I swipe once, the custom buttons show (not the barbuttonitem), but pressing them gives me the unrecognized selector errors telling me the initial target of self (the detailVC) is gone. why would this get released? why do the buttons show not on the first load (viewdidload is called)? It just seems like I'm missing a piece connecting the TableVC to PageVC to DetailVC and having the nav controller and bar propagate through. It's just not thinking a nav controller is there it seems.</p>
  
  <p>Current setup: Storyboarded with initial VC as nav controller. Everything worked. I've now taken a cell and wired to a new view controller (that adopts UIPageViewControllerDataSource). Then in its viewdidload i have:</p>
  
  <pre><code>// Create page view controller
  self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
  self.summaryPageViewController.dataSource = self;
  
  myContentViewController *startingViewController = [self viewControllerAtIndex:self.rowTapped];
  NSArray *viewControllers = @[startingViewController];
  [self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
  </code></pre>
  
  <p>Now i have the following, which i see in apple's example</p>
  
  <pre><code>[self addChildViewController:self.pageViewController];
  [self.view addSubview:self.pageViewController.view];
  [self.pageViewController didMoveToParentViewController:self];
  </code></pre>
  
  <p>The segue from the table to the view controller keeps the nav (push segue), but I'm losing it after that it seems. I tried adding <code>[self.navigationController pushViewController:self.summaryPageViewController animated:NO];</code> but that gives me "nested push animation can result in corrupted navigation bar" errors. Like I said, this accomplishes the basics of letting me swipe between views and have the different data show, but it's clear something's missing. I've googled all over the place, but can't find what i'm missing to make pageviewcontroller and nav controller play nice together. Thanks so much in advance for the help and let me know what else i can provide to help.</p>
  
  <p>SORTA SOLUTION:
  Awarded the bounty for the only answer. It's not quite everything i needed, but mark was helpful and the main thing was to pass a navItem property and add the buttons so that. Be careful with the viewdidload and appear methods on your "content" view controller as they page view controller will not call things in the sequence you're used to as its loading the previous and next controller.</p>