导航栏正在向状态栏移动 [英] Navigation bar is moving up to statusbar

查看:115
本文介绍了导航栏正在向状态栏移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 viewController 。哪个没有 navigationBar。我正在推送另一个 viewController ,它有 navigationBar。哪个涨了
我使用下面的代码来显示 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...

在firstV中实现以下方法C.

override func viewWillAppear(_ animated: Bool) {

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

override func viewWillDisappear(_ animated: Bool) {

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

输出:已更新

这篇关于导航栏正在向状态栏移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆