Navigation bar is moving up to statusbar(导航栏正在向上移动到状态栏)
问题描述
我有一个 viewController.哪个没有 navigationBar. 我正在推动另一个具有 navigationBar. 的 viewController 正在上升我正在使用以下代码来显示 navigationBar
I have a viewController. Which does not have navigationBar. I am pushing another viewController that has navigationBar. Which is going up
I am using following code to show the navigationBar
self.navigationController?.setNavigationBarHidden(false, animated: false)
推荐答案
我相信你试图在 firstVC 中隐藏 navigationBar 并在 secondVC 中显示它代码>.
I believe you trying to hide navigationBar in firstVC and show it in secondVC.
在您的 firstVC 中尝试以下方法,并确保您使用 navigationController 嵌入了您的 firstVC.
Try following method into your firstVC and make sure you embedded your firstVC with navigationController.
您的 storyBoard 流程布局应如下所示...
Your storyBoard flow layout should be look like below...
在 firstVC 中实现以下方法.
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.setNavigationBarHidden(true, animated: true)
}
override func viewWillDisappear(_ animated: Bool) {
self.navigationController?.setNavigationBarHidden(false, animated: true)
}
输出:更新
这篇关于导航栏正在向上移动到状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:导航栏正在向上移动到状态栏
基础教程推荐
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
