2

我在我的应用程序中设置了一个工作 UIPageviewcontroller。我想自定义用户翻页时显示的页面背面。现在的默认行为是以 40% 左右显示前视图。是否可以以背面是我指定的视图的方式进行设置?

编辑:也许我应该澄清一下,我希望视图的背面始终是相同的视图。例如纯红色。同样的问题已经在这里问过如何将阴影背景白色更改为其他颜色

这是我在脊椎位置方法中使用的代码。在我阅读的 setViewControllers 方法的评论中:

For transition style 'UIPageViewControllerTransitionStylePageCurl', if 'doubleSided' is 'YES' and the spine location is not 'UIPageViewControllerSpineLocationMid', two view controllers must be included, as the latter view controller is used as the back.

所以如果我这样做:

-(UIPageViewControllerSpineLocation)pageViewController:
(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation    (UIInterfaceOrientation)orientation
{
    UIViewController *currentViewController = self.pageViewController.viewControllers[0];
    UIViewController *backsideViewController = [[BackSideViewController alloc]init];
    self.pageViewController.doubleSided = YES;
    NSArray *viewControllers = @[currentViewController,backsideViewController];
    [self.pageViewController setViewControllers:viewControllers     direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:NULL];
    return UIPageViewControllerSpineLocationMax;
}

我得到错误: The number of provided view controllers (2) doesn't match the number required (1) for the requested spine location (UIPageViewControllerSpineLocationMax)

4

0 回答 0