Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's what worked for me. I used the default project which is generated by apple page view template. But when I was using it inside navigation controller it was not displaying the spine properly so had to modify the initialization code which can be called from viewDidLoad method.</p> <pre><code>- (void)initializePageViewController { int numberOfPagesPerScreen = 1; if(UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) numberOfPagesPerScreen = 1; else numberOfPagesPerScreen = 2; // for two-page layouts, we'll need to specify the spine location NSDictionary *pageViewOptions = nil; if(numberOfPagesPerScreen == 2) pageViewOptions = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInteger:UIPageViewControllerSpineLocationMid], UIPageViewControllerOptionSpineLocationKey, nil]; self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:pageViewOptions]; self.pageViewController.delegate = self; NSMutableArray *pageViewControllers = [NSMutableArray array]; for(int pageViewIdx = 0; pageViewIdx &lt; numberOfPagesPerScreen; pageViewIdx++) { MyPageViewController *pageController = [self.modelController viewControllerAtIndex:pageViewIdx storyboard:self.storyboard]; [pageViewControllers addObject:pageController]; } [self.pageViewController setViewControllers:pageViewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL]; self.pageViewController.dataSource = self.modelController; [self addChildViewController:self.pageViewController]; [self.view addSubview:self.pageViewController.view]; // Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages. CGRect pageViewRect = self.view.bounds; pageViewRect = CGRectInset(pageViewRect, 40.0, 40.0); self.pageViewController.view.frame = pageViewRect; [self.pageViewController didMoveToParentViewController:self]; // Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily. self.view.gestureRecognizers = self.pageViewController.gestureRecognizers; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload