UINavigationController without navigation bar?(UINavigationController 没有导航栏?)
问题描述
我有一个通用应用程序,在 iPad 版本上我使用 UISplitViewController 创建一个类似于邮件应用程序的界面.
I have a universal app, and on the iPad version I'm using UISplitViewController to create an interface similar to the Mail app.
我在推送新的 Detail 视图时遇到了麻烦,因此我决定使用 UINavigationController 以便可以根据需要推送和弹出视图.但是,我不想使用导航视图或工具栏.但是无论我做什么,我都无法隐藏导航栏.
I was having trouble pushing new Detail views, so I decided to use a UINavigationController so I could just push and pop views as needed. However, I do not want to use the navigation view or a toolbar. But no matter what I do, I can't hide the navigation bar.
我尝试在 IB 中取消选中显示导航栏",我也尝试过设置:
I've tried unchecking "Shows Navigation Bar" in IB, and I've also tried setting:
[self.navigationController setNavigationBarHidden:YES];
在 viewDidLoad/viewDidAppear/viewWillAppear 中.我还在将要推送的每个视图中都进行了尝试.没有任何效果.
in the viewDidLoad/viewDidAppear/viewWillAppear. I've also tried it in each of the views that will be pushed. Nothing works.
这里有什么我遗漏的吗?是否可以有一个没有工具栏或导航栏的 UINavigationController?
Is there something I'm missing here? Is it possible to have a UINavigationController without a toolbar or navigation bar?
推荐答案
你应该能够做到以下几点:
You should be able to do the following:
self.navigationController.navigationBar.isHidden = true //Swift 5
self.navigationController(显然)是 UINavigationController 的一个实例.似乎对我有用,但我只是在发布之前对其进行了简单的测试.
where self.navigationController is (obviously) an instance of UINavigationController. Seems to work for me, but I only briefly tested it before posting this.
这篇关于UINavigationController 没有导航栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UINavigationController 没有导航栏?
基础教程推荐
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
