UIPageViewController and off screen orientation changes

旧街凉风 提交于 2019-12-22 10:39:06

问题


My app is a tab bar application running on iPad.

One of the tabs contains a UIPageViewController, which I implemented pretty much as per the tutorial here: Implementing UIPageViewController programmatically – without storyboarding.

Everything works great, including rotation. However there is a problem - if I go to the tab containing the page view controller, then navigate to a different tab and change the orientation. Then navigation back to the tab containing the page view controller, it is now displayed incorrectly.

Rotating the device again, with the page view controller visible, fixes things.

I guess this is because

pageViewController:spineLocationForInterfaceOrientation:

is not called while that tab is not visible. Any ideas on how to remedy this?


回答1:


I had the same problem and ended up doing the same workaround. When I was done I didn't really hate it though, because it allowed me to free-up the UIPageViewController and all of it's child UIPageViewControllers and all of their resources when the user wasn't actively using the tab.




回答2:


I worked around this by re-initialising the UIPageViewController inside viewWillAppear:animated. Not ideal, but it works...



来源:https://stackoverflow.com/questions/10111156/uipageviewcontroller-and-off-screen-orientation-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!