title: table view slides up under navigation bar when user taps row
body: <p>I have a <code>UINavigationController</code> (NC) containing a <code>UITableViewController</code> (TVC0). When the user taps a row, it loads a <code>UIPageViewController</code> (PVC), which pages back and forth between other <code>UITableViewController</code>s (TVC1).</p>
  
  <p>TVC0 shows up inside NC (meaning it doesn't hide behind the navigation bar at the top or the tab bar at the bottom). When it pushes PVC, the first TVC1 appears inside the bounds of the nav bar and tab bar. However when I swipe, the TVC1s inside are hidden behind the navigation bar and tab bar. I can pull to reveal the contents, but when I release, it snaps back to behind the bar.</p>
  
  <p>How can I force everything to appear between the two bars? I can't use storyboard (because it's a legacy app) and the embed in... option isn't available.</p>
  
  <p>[Edit]</p>
  
  <p>I added some logging and discovered that my embedded TVC1s frame has an absolute origin of 0, 64, but as soon as I tap, it goes to 0, 0. If I can't figure out a real solution, I can always fake it by adding 64, but I'd much rather figure out what's actually wrong.</p>
  
  <p>[/Edit]</p>
  
  <p>[More Edit]</p>
  
  <p>I was testing another area in the iOS 6 simulator and discovered that this paging works flawlessly in iOS 6. So the issue I'm seeing is iOS 7 specific.</p>
  
  <p>[/More Edit]</p>
  
  <p>Here is my TVC0 <code>viewDidLoad</code>, PVC <code>pageViewController:viewControllerBeforeViewController:</code>, and a helper <code>viewControllerAtIndex:</code>:</p>
  
  <pre><code>- (void) viewDidLoad
  {
      [super viewDidLoad];
      NSDictionary* options = [NSDictionary dictionaryWithObject:
                               [NSNumber numberWithInteger: UIPageViewControllerSpineLocationMin]
                                                          forKey:
                               UIPageViewControllerOptionSpineLocationKey];
      self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:
                             UIPageViewControllerTransitionStyleScroll
                                                            navigationOrientation:
                             UIPageViewControllerNavigationOrientationHorizontal
                                                                          options: options];
  
      self.pageController.dataSource = self;
      self.pageController.view.frame = self.view.frame;
      NSArray* viewControllers =
              [NSArray arrayWithObject: [self viewControllerAtIndex: self.initialIndex]];
  
      [self.pageController setViewControllers: viewControllers
                                    direction: UIPageViewControllerNavigationDirectionForward
                                     animated: NO
                                   completion: nil];
  
      [self addChildViewController: self.pageController];
      [self.view addSubview: self.pageController.view];
      [self.pageController didMoveToParentViewController: self];
  
      for (UIGestureRecognizer* recognizer in self.pageController.gestureRecognizers)
      {
          if ([recognizer isKindOfClass: [UITapGestureRecognizer class]])
          {
              recognizer.enabled = NO;
          }
      }
  }
  
  // SearchResultsList is TVC1
  - (SearchResultsList*) viewControllerAtIndex: (NSUInteger) index
  {
      if (index &gt;= self.items.count)
      {
          return nil;
      }
  
      SearchResultsList* retVal = [[SearchResultsList alloc]
                                      initWithNibName: @"SearchResultsList" bundle: nil];
  
      MyListItem* myItem = [self.items objectAtIndex: index];
      MyMatchesRequest* matches = [[MyMatchesRequest alloc] initWithItemId: myItem.itemId];
      [matches execute: ^(MySearchResults* results)
       {
           retVal.tableData = [NSMutableArray arrayWithArray: results.items];
           retVal.view.frame = self.view.frame;
           retVal.myItem = myItem;
           retVal.index = index;
           self.title = myItem.displayText;
           [[retVal tableView] reloadData];
       }];
  
      return retVal;
  }
  
  - (UIViewController*) pageViewController: (UIPageViewController*) pageViewController
        viewControllerBeforeViewController: (UIViewController*) viewController
  {
      SearchResultsList* vc = (SearchResultsList*)viewController;
      if (vc.index == 0)
      {
          [self.navigationController popViewControllerAnimated: YES];
          return nil;
      }
  
      return [self viewControllerAtIndex: vc.index - 1];
  }
  </code></pre>