Note that there are some explanatory texts on larger screens.

plurals
  1. POUIPageViewController doesn't work at all; totally blank
    primarykey
    data
    text
    <p>So,</p> <p>I'm trying to use the <code>UIPageViewController</code> with a custom application workflow, but I'm implementing it exactly as recommended in the docs.</p> <pre><code> self.pageViewController = [[[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil] autorelease]; //calls setViewControllers:direction:animated:completion with valid UIViewControllers [self setupPagesWithIndex:0]; self.pageViewController.delegate = self; self.pageViewController.dataSource = self; self.view.frame = CGRectMake(0, 0, 1024, 768); self.pageViewController.view.backgroundColor = [UIColor grayColor]; </code></pre> <p>Here is where I set the view controllers...</p> <pre><code>- (void) setupPagesWithIndex:(NSInteger) index { UIViewController* vc1 = [self uicontrollerForIndex:index]; UIViewController* vc2 = [self uicontrollerForIndex:index+1]; [self.pageViewController setViewControllers:[NSArray arrayWithObjects:vc1,vc2, nil] direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil]; } </code></pre> <p>The only thing that appears on screen is the grey background color. I have verified that the <code>UIViewControllers</code> are valid, have good frames and I even gave them background colors just so I could see <em>something</em></p> <p>This is how I'm adding the UIPageViewController to the screen: </p> <pre><code> [[self rootViewController] addChildViewController:self.pageViewController]; [[self rootViewController].view addSubview:self.pageViewController.view]; </code></pre> <p><code>[self rootViewController]</code> returns the application's rootViewController.</p> <p>The view is definitely visible, because I can see the backgroundcolor I apply... however, the UIPageViewController is just totally blank!</p> <p>I implemented all of the datasource and delegate methods and adopted the protocols; they never even get called!</p> <p>My question is; what are all of the requirements for the UIPageViewController to display pages when you do everything programmatically?</p> <p>edit #1, per request: This class is a controller for UIPageViewController within my own application-building framework. I'm giving the controller two ways of building a page right now -- from an image name or from a kind of asset key. In either case, it ultimately returns a view which I wrap with a UIViewController.</p> <p>I create the view controller with</p> <pre><code>UIViewController* vc = [[[PageTest alloc] initWithNibName:@"PageTest" bundle:nil] autorelease]; </code></pre> <p>'PageTest' is just a UIViewController with a corresponding nib, which is blank except for the auto-generated settings. I then add my custom view as a subview to this view controller. This is what comes back from uicontrollerForIndex:</p> <p>edit #2, further discovery</p> <p>I've found a way to show the book flipper; if I only initialize it with one view controller it will show the book flipper. It doesn't matter if the two view controllers are different classes entirely; if I setViewControllers with two of them then nothing shows.</p> <p>if I return <code>UIPageViewControllerSpineLocationMid</code> in the delegate method</p> <pre><code>- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation </code></pre> <p>Then upon rotation, the app will crash without an identifiable backtrace.</p>
    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.
 

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