title: UIPageViewControllerSpineLocation Delegate Method Not Firing
body: <p>Major head-scratcher all day on this one :-(</p>
  
  <p>I have an instance of a UIPageViewController that does not appear to be firing the delegate method:</p>
  
  <pre><code>-(UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController
                    spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation
  </code></pre>
  
  <p>I have tried various methods of displaying the UIPageViewController and have settled on a programatic approach (as opposed to a Storyboard one) that appears to be working correctly, with one exception... when rotating the iPad to landscape the spine does not appear mid-point as expected. I simply cannot find out why the delegate method does not get called.</p>
  
  <p><strong>Code Explanation (simplified for example)</strong></p>
  
  <p>Consider three classes as follows:</p>
  
  <ul>
  <li>RootViewController - loaded when the app starts</li>
  <li>PageViewController - loaded by RootViewController upon user initiation</li>
  <li>PageContentViewController - loaded by PageViewController when pages are needed</li>
  </ul>
  
  <p>Fairly self-explanatory. The RootViewController is loaded by the app upon launch. When the user taps an image within this view controller's view (think magazine cover opening a magazine) it launches the PageViewController as follows:</p>
  
  <pre><code>PageViewController *pvc = [[PageViewController alloc] initWithNibName:@"PageView" 
                                             bundle:[NSBundle mainBundle]];
  pvc.view.frame = self.view.bounds;
  [self.view addSubview:pvc.view];
  </code></pre>
  
  <p>In the actual app there is animation etc to make the transition all nice, but essentially the PageViewController's view is loaded and takes fullscreen.</p>
  
  <p><strong>PageViewController</strong> </p>
  
  <p>This is the workhorse (only relevant methods shown). I have tried various examples from the infinite world of Google and written directly from the Apple docs...</p>
  
  <pre><code>@interface PageViewController : UIViewController &lt;UIPageViewControllerDelegate, UIPageViewControllerDataSource&gt;
  
  @property (nonatomic, strong) UIPageViewController *pageViewController;
  @property (nonatomic, strong) NSMutableArray *modelArray;
  
  @end
  
  
  @implementation TXCategoryController
  
  -(void)viewDidLoad 
  {
  
      [super viewDidLoad];
  
      // Simple model for demo
      self.modelArray = [NSMutableArray alloc] init];
  
      for (int i=1; i&lt;=20; i++)
          [self.modelArray addObject:[NSString stringWithFormat:@"Page: %d", i]];
  
      self.pageViewController = [[UIPageViewController alloc] 
                 initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl
                   navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
  
      self.pageViewController.delegate = self;
      self.pageViewController.dataSource = self;
  
      PageContentViewController *startupVC = [[PageContentViewController alloc] initWithNibName:@"PageContent" bundle:nil];
  
      startupVC.pageLabel = [self.modelArray objectAtIndex:0];
  
      [self.pageViewController setViewControllers:[NSArray arrayWithObject:startupVC]
                                        direction:UIPageViewControllerNavigationDirectionForward
                                         animated:NO
                                       completion:nil];
  
      [self addChildViewController:self.pageViewController];
      [self.view addSubview:self.pageViewController.view];
      [self.pageViewController didMoveToParentViewController:self];
      self.pageViewController.view.frame = self.view.bounds;
      self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
  
  }
  
  -(UIViewController *)pageViewController:(UIPageViewController *)pageViewController
    viewControllerBeforeViewController:(UIViewController *)viewController
  {
      // Relevant code to add another view...
  }
  
  -(UIViewController *)pageViewController:(UIPageViewController *)pageViewController
     viewControllerAfterViewController:(UIViewController *)viewController
  {
      // Relevant code to add another view...
  }
  
  -(UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController
                    spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation
  
  {
      // Setting a break point in here - never gets called
  
      if (UIInterfaceOrientationIsPortrait(orientation))
      {
          // Relevant code to create view...
          return UIPageViewControllerSpineLocationMin;
      }
  
      // Relevant code to create 2 views for side-by-side display and
      // set those views using self.pageViewController setViewControllers:
  
      return UIPageViewControllerSpineLocationMid
  }
  
  @end
  </code></pre>
  
  <p>This all works perfectly well as I mentioned earlier. The PageViewController's view gets shown. I can swipe pages left and right in both portrait and landscape and the respective page number appears. However, I don't ever see two pages side-by-side in landscape view. Setting a breakpoint in the spineLocationForInterfaceOrientation delegate method never gets called.</p>
  
  <p>This is such a head-scratcher I have burned out of ideas on how to debug/solve the problem. It almost behaves like the UIPageViewController isn't responding to the orientation changes of the device and therefore isn't firing off the delegate method. However, the view gets resized correctly (but that could be just the UIView autoresizing masks handling that change).</p>
  
  <p>If I create a brand new project with just this code (and appropriate XIb's etc) it works perfectly fine. So something somewhere in my actual project is causing this. I have no idea where to continue looking. </p>
  
  <p>As usual, any and all help would be very much appreciated.</p>
  
  <p><strong>Side Note</strong></p>
  
  <p>I wanted to add the tag 'uipageviewcontrollerspinelocation' but couldn't because it was too long and I didn't have enough reputation (1500 required). I think this is a devious ploy on Apple's part to avoid certain tags in Stackoverflow... ;-)</p>