UIPageViewController在旋转时重置为第一页 [英] UIPageViewController resets to first page on rotation
问题描述
当用户旋转设备时, UIPageViewController
会从显示回第一页的任何页面淡出。这真的很烦人,尤其是当用户将多个页面放入文档时。它只发生在iOS 6中。
When the user rotates their device, the UIPageViewController
fades from whatever page it is displaying back to the first page. This is really annoying, especially when the user is multiple pages into the document. It only occurs in iOS 6.
当用户旋转设备时,会调用 spineLocationForInterfaceOrientation
,这可能有一些东西该问题。
When the user rotates their device, spineLocationForInterfaceOrientation
is called, which probably has something to do with the issue.
- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController
spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation {
return UIPageViewControllerSpineLocationMin;
}
我总是希望脊柱在左边。
I always want the spine to be on the left.
您是否知道导致 UIPageViewController
重置的原因是什么?我发现了一个错误报告这里,但我无法在网上找到任何其他信息,让我思考我做错了。
Do you have any idea what is causing the UIPageViewController
to reset? I found a bug report here, but I have been unable to find any other information online, leaving me to think that I am doing something wrong.
推荐答案
您的 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;
}
这篇关于UIPageViewController在旋转时重置为第一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!