当用户旋转他们的设备时,UIPageViewController
从它显示的任何页面淡出回到第一页。这真的很烦人,尤其是当用户将多个页面放入文档时。它只出现在 iOS 6 中。
当用户旋转他们的设备时,spineLocationForInterfaceOrientation
被调用,这可能与问题有关。
- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController
spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation {
return UIPageViewControllerSpineLocationMin;
}
我总是希望书脊在左边。
你知道是什么导致 UIPageViewController
重置吗?我发现了一个错误报告 here , 但我一直无法在网上找到任何其他信息,让我觉得我做错了什么。
最佳答案
您的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;
}
关于iphone - UIPageViewController 在旋转时重置为第一页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14132132/