3

当用户旋转他们的设备时,UIPageViewController它会从它显示的任何页面淡出回到第一页。这真的很烦人,尤其是当用户将多个页面放入文档时。它仅出现在 iOS 6 中。

当用户旋转他们的设备时,spineLocationForInterfaceOrientation被调用,这可能与问题有关。

- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController
               spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation {

    return UIPageViewControllerSpineLocationMin;

}

我总是希望脊椎在左侧。

你知道是什么导致UIPageViewController重置吗?我在这里发现了一个错误报告,但我一直无法在网上找到任何其他信息,让我认为我做错了什么。

4

3 回答 3

2

我不知道存在这样的错误,但最坏的情况是,您可以覆盖

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;

捕获旧状态并在转换完成后重新设置它。我很想相信还有其他原因导致了这个问题,但没有更多数据,我无法判断。你能发布更多的 UIPageViewController 代码吗?

于 2013-01-03T02:43:33.820 回答
2

spineLocationForInterfaceOrientation的不完整

它应该是这样的:

- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController
                   spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation
{

        UIViewController *currentViewController = self.pageViewController.viewControllers[0];
        NSArray *viewControllers = @[currentViewController];
        [self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL];

        return UIPageViewControllerSpineLocationMin;

}
于 2013-01-03T09:58:02.123 回答
-1

我遇到过同样的问题。我发现只是spineLocationForInterfaceOrientation为我删除了修复它的实现。

于 2013-01-07T01:42:23.513 回答