2013-02-17 51 views
2

我在我的应用程序设立了一个工作UIPageviewcontroller。 我想自定义当用户打开页面时显示的页面的背面。 现在的默认行为是显示40%左右的frontview。 是否可以将背面设置为我指定的视图?UIPageViewController后视图

编辑: 也许我要澄清,我想视图的背面永远是相同的观点。例如纯红色。同样的问题已经在这里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)

回答

-1
+1

我读过的文档,但我还没有找到一个解决我的问题。这是评论在setViewController方法中说的。 '对于过渡风格UIPageViewControllerTransitionStylePageCurl',如果“的双面”是“YES”,并作为后者视图控制器用作back.'所述脊骨位置是不是“UIPageViewControllerSpineLocationMid”中,两个视图控制器必须包括,但如果我提供2 viewcontrollers我得到的异常'提供的视图控制器(2)不匹配(1)请求的脊骨位置(UIPageViewControllerSpineLocationMin)所要求的数量数量' – 2013-02-25 19:51:34

+0

你能粘贴代码?与问题太.. – 2013-02-26 03:53:08

+0

我已经在原来的帖子中添加它。 – 2013-02-26 18:43:46

相关问题