菜鸟教程小白 发表于 2022-12-12 23:46:27

ios - UITableViewController 中的导航栏与状态栏重叠


                                            <p><p>在我的 UITableViewControllers 中,我添加了导航栏,但问题是导航栏的标题与状态栏相交。通常我会做“positionForBar”并返回 UIBarPositioningTopAttached 但这仅适用于 UIViewControllers。因此,我使用“prefersStatusBarHidden”方法返回 YES。显然,这会给用户带来成本,因为他们在使用应用程序时无法在这些屏幕上查看时间和电池生命周期。那么有没有办法让标题导航栏和状态栏不重叠,有点像 iOS 6 中的?</p>

<p>这就是我所说的:
<img src="/image/mVRbQ.png" alt="enter image description here"/> </p>

<p>它看起来不是很干净,我正在尝试修复它</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>在 Storyboard 中单击您的 UITableViewController 然后只需单击编辑 -> 嵌入 -> 导航 Controller 。您无需使用它来导航任何地方,但它会为您正确设置标题栏。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - UITableViewController 中的导航栏与状态栏重叠,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/24660916/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/24660916/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - UITableViewController 中的导航栏与状态栏重叠