首页 > 解决方案 > 带有 LargeTitles 的自定义 UINavigationBar 在 IB 中不起作用

问题描述

所以我用 .xib 文件创建了 MyViewController 类。我拖放了一个 NavBar 并将其放置在安全区域的范围内。

MyViewController 在其他地方实例化并放在 UINavigationController 中。

let myVC = MyViewController(nibName: "MyViewController", bundle: nil)
let nav = UINavigationController(rootViewController: myVC)
self.present(nav, animated: true, completion: nil)

在我设置的 MyViewController 里面

self.navigationController?.setNavigationBarHidden(true, animated: false)

所以 UINavigationController 的默认导航栏没有显示,我只看到我的自定义导航栏,我可以手动编程他的行为和东西。

现在.. 在 IB 中,我勾选了Prefers Large Titles框,但任何地方似乎都没有改变。有任何想法吗 ?

不,我不想将我的 VC xib 放入 UINavigationController,我想将其保留为 UIViewController,以便以编程方式在其他地方随意使用它,并分别拥有自己的 UINavigationBar。

在此处输入图像描述

标签: iosswiftxcodeuinavigationcontrollerinterface-builder

解决方案


推荐阅读