我的导航栏显示在情节提要中,但未显示在模拟器中 [英] My navigation bar is showing up in storyboard but not in the simulator
问题描述
当尝试在左侧按钮上添加用于搜索的导航栏,并最终在右侧栏按钮上添加设置按钮时,该栏未显示在模拟器中.屏幕截图
When trying to add a navigation bar for searching on the left button and eventually a setting button on the right bar button, the bar isn't showing up in the simulator. Screenshot
我应该使用常规工具栏,例如底部的临时工具栏吗?我希望使用搜索按钮来加载新地址,并为明显的页面设置,但是随后我希望这些按钮可以用作在选项卡之间移动的导航.我应该只在地图视图上方实现搜索栏,在右侧实现设置按钮吗?我是xcode的新手,正在踢我的屁股.
Should I be using a regular toolbar like the temporary one I have on the bottom? I'd prefer the search button for loading new addresses, and settings for the obvious, but then I want buttons that serve as navigations for moving from tab to tab. Should I simply implement a search bar above the map view and a settings button on the right? I'm new to xcode and it's kicking my ass.
将隐藏的内容更改为"self.navigationController?.setToolbarHidden(false,animation:true)"后,工具栏出现,但在当前工具栏的底部,带有缩放和类型按钮.如此看来,它认为它是一个工具栏,只想将其放在底部?
After changing the hidden to "self.navigationController?.setToolbarHidden(false, animated: true)" the toolbar appeared but at the bottom below the current toolbar with zoom and type buttons. So it looks as if it thinks it's a toolbar and only wants to put it at the bottom?
推荐答案
Swift 4解决方案
将此代码添加到您的ViewController:
Add this code to your ViewController:
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.navigationBar.isHidden = false
}
这篇关于我的导航栏显示在情节提要中,但未显示在模拟器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!