UIPageViewController.viewControllers resetting on first interface rotation
| Originator: | karol.kozimor | ||
| Number: | rdar://12745144 | Date Originated: | 23-Nov-2012 11:42 PM |
| Status: | Open | Resolved: | |
| Product: | iPhone SDK | Product Version: | 6.0 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: UIPageViewController's viewControllers resetting some time after previous calls to setViewControllers: and subsequent first (since application start) call to spineLocationForInterfaceOrientation:, resulting in the controller's showing the starting page of the model, regardless of the state before rotation. Problem is present in Apple sample code as well. Description - (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation is called first time upon application launch with the correct view controller set in -viewDidLoad or elsewhere. After the interface rotation, spineLocationForInterfaceOrientation: is called again, with the pageViewController instance's viewControllers array reset to whatever the initial state was. This happens in both landscape and portrait as starting positions, but only once per application run. Steps to Reproduce: Create a new project using the Page-Based Application template. Build for iOS 6, run on device or simulator in any orientation. On application start, January appears. Swipe/tap to get to March. Then rotate the device. Expected Results: March or March/April appears. Actual Results: January or January/February appears. Regression: Bug not present in iOS 5.1.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Possible solution
I had the same issue and found a solution. See this link: http://stackoverflow.com/questions/14132132/uipageviewcontroller-resets-to-first-page-on-rotation. If the bug is present in Apple's sample code, then it may be an issue with your device. I am unable to reproduce the issue with Apple's sample code.
I don't think the link Jack posted is a solution. It seems to be a different problem. It's not a device issue, either, because it also happens in the simulator.
I ran into the same issue as the original poster while playing with Apple's default Page-Based View template. It happens only on the first orientation change and only in iOS6: if you rotate after flipping a few pages in, the pages are reset and start from index 0. Subsequent rotations work fine. Again, this happens with the default template from Apple, no changes at all.
I just posted an official bug report with Apple about this.