我在我的应用中设置了一个可用的UIPageviewcontroller。 我想自定义用户翻页时显示的页面背面。 现在的默认行为是将前视图显示为40%左右。 是否可以以背面是我指定的视图的方式进行设置?
编辑: 也许我应该澄清一下,我希望视图的背面始终是相同的视图。例如纯红色。同问这里How to change shadow background white to other colors
这是我在脊柱位置方法中使用的代码。在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)