菜鸟教程小白 发表于 2022-12-12 13:35:26

ios - 当应用程序处于横向模式时,将隐藏未调用的 ViewController


                                            <p><p>我正在创建一个 iPhone 通用应用程序并实现 willHideViewController 方法。此方法在 iPad 纵向模式下调用,但在 iPad 横向模式下不调用。
谁能给出解决方案?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p><code>willHideViewController</code> 自 iOS8 以来已被弃用 (<a href="https://developer.apple.com/documentation/uikit/uisplitviewcontrollerdelegate/1623175-splitviewcontroller?language=objc" rel="noreferrer noopener nofollow">source</a>)</p>

<p>你需要使用 <code>splitViewController:willChangeToDisplayMode:</code> 方法,因为没有保证 <code>willHideViewController</code> 将继续正常工作(你发现它不是!) </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 当应用程序处于横向模式时,将隐藏未调用的 ViewController,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/44965293/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/44965293/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 当应用程序处于横向模式时,将隐藏未调用的 ViewController