是否可以隐藏 UISplitViewController 上的导航栏?

发布于 2024-09-30 15:09:40 字数 423 浏览 0 评论 0原文

我有一个非常简单的应用程序,我想在其中使用 UISplitViewController。它太简单了,我不希望导航栏在纵向中可见,因为左窗格中没有导航。 (我确实想以纵向方式显示它,以便弹出窗口出现。但是,我似乎无法隐藏它。顶部元素甚至是导航栏吗?

我已经尝试过这两种方法:

[[splitViewController navigationController] setNavigationBarHidden:YES animated:NO];

for(UIViewController* vc in [splitViewController viewControllers]) {
    [[vc navigationController] setNavigationBarHidden:YES animated:NO];

}

但都不起作用。

I have a very simple app that I want to use a UISplitViewController in. It's so simple that I don't want the NavigationBar visible in portrait because there is no navigation in the left pane. (I do want to show it in portrait for the Popover to appear from. However, I don't seem able to hide it. Is the top element even a Nav Bar?

I've tried both of these:

[[splitViewController navigationController] setNavigationBarHidden:YES animated:NO];

for(UIViewController* vc in [splitViewController viewControllers]) {
    [[vc navigationController] setNavigationBarHidden:YES animated:NO];

}

But neither works.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忘年祭陌 2024-10-07 15:09:40

你试试这个:

源代码:
https://github.com/mattgemmell/MGSplitViewController/

它有助于隐藏 SplitViewController 上的导航栏

you try this:

source code:
https://github.com/mattgemmell/MGSplitViewController/

it helpful for hide the nav bar on a SplitViewController

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文