ios - 如何通知父 View Controller 模态视图 Controller 中更改的屏幕方向?
<p><p>当处于纵向模式时,我在 UISplitViewController 上方展示了一个模态视图 Controller 。现在我将 iPad 旋转到横向模式并关闭模态视图 Controller 。</p>
<p>UISplitViewController 似乎没有收到有关更改方向的通知:
Split View Controller 的第一个 View 被隐藏,第二个 View 没有占据整个屏幕大小。</p>
<p>如果我再次来回旋转, Split View Controller 再次正常显示。</p>
<p>此外,该问题仅出现在 iOS Simulator 5.0(或运行 iOS5 的设备)上,而不会出现在 4.3 上。</p>
<p>有什么想法吗?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我也有同样的问题。</p>
<p>在我的项目中 splitViewController 被添加为窗口上的 subview 。它正常接收轮换消息。但是当我尝试将我的“模态” ViewController 添加为窗口上的 subview 时,它不会收到旋转消息。看起来旋转消息仅在索引 0 处接收 subview 。所以我以这种方式解决了它:</p>
<p>显示“模态” ViewController </p>
<pre><code>;
;
</code></pre>
<p>隐藏“模态” ViewController </p>
<pre><code>;
;
</code></pre>
<p>但是这个解决方案有一个缺陷:modalViewController 在调用“<code></code>”方法后不会立即加载它的 View 。为了修复这个缺陷,我暂时将其呈现为模态:</p>
<p>显示“模态” ViewController :</p>
<pre><code>// present and dismiss methods are called to cause viewDidLoad in modalViewController
;
;
;
;
</code></pre></p>
<p style="font-size: 20px;">关于ios - 如何通知父 ViewController 模态视图 Controller 中更改的屏幕方向?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/7767302/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/7767302/
</a>
</p>
页:
[1]