UIPageViewController和屏幕外的方向更改

UIPageViewController和屏幕外的方向更改

本文介绍了UIPageViewController和屏幕外的方向更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序是在iPad上运行的标签栏应用程序.

My app is a tab bar application running on iPad.

其中一个标签包含一个UIPageViewController,我已按照此处的教程进行了很多实现:以编程方式实现UIPageViewController-无需情节提要.

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

一切正常,包括轮换.但是,有一个问题-如果我转到包含页面视图控制器的选项卡,则导航至其他选项卡并更改方向.然后导航 back 到包含页面视图控制器的选项卡,现在它显示不正确.

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.

我想这是因为

pageViewController:spineLocationForInterfaceOrientation:

当该选项卡不可见时,不会调用

.关于如何解决这个问题的任何想法?

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

推荐答案

我通过在viewWillAppear:animated中重新初始化UIPageViewController来解决此问题.不太理想,但是有效...

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

这篇关于UIPageViewController和屏幕外的方向更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 03:58